Originally posted by Ameya Thakur:
I wanted my Resultset to get only the last 'n' records from the resultSet.
Say for Example, My Query Return 10 rows and i wanted to display only the last 4 records of the query.
Hi Ameya,
This can be done in
java as well as on DB side. Which way you want to do it depends on your total number of records and some other factors.
1. In java approach, fetch all records from DB. Then using ScrollableResultSet, display only certain number of records each time.
2. In DB approach, write a query such that you will only fetch those records which are to be displyed. Here, for showing next set of records, you have to query the DB again. I have not used this approach much, but these queries are usually written using default "ROWNUM" field (I am talking about Oracle).
I Hope this will help.
Sachin