hi all is there a way to set the current position of the cursor in a resultset to the row number that i choose. for example if i have a resultset containing 1000 records and i want only the last 500, is there a way i can set the cursor to start from record 500?
of course i can call next() method 500 times, but is there a more elegant way?
Originally posted by Purushothaman Thambu: You have to use Scrollable resultset. Something like below
However check the JDBC Driver if it support Scrollable resultset.
Also however, many drivers (but not all) will still transfer those first 500 rows from the database to your driver, where the driver will iterate through them to the row you want. Same thing as what you're trying to avoid, just pushed down a level.
What you really want to do is write your SQL to avoid those first 500 rows totally. Here's SQL I would use on an Oracle DB to get the 2nd 100 rows from something: