wood burning stoves 2.0*
The moose likes JDBC and the fly likes oracle record fetch Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "oracle record fetch" Watch "oracle record fetch" New topic
Author

oracle record fetch

sugath nelabhotla
Greenhorn

Joined: Apr 24, 2006
Posts: 4
Hi, i know that when we use select * from table where rownum < 100, we get the first 100 records from the table. Is there any way that I can get the next 100 records from the table? rownum > 100 does not work. My table is not indexed and does not a primary key. Currently I am sorting the table and keeping track of 101 record id and then triggering the second batch query using the rec id.

Thanks
Madhu
Purushoth Thambu
Ranch Hand

Joined: May 24, 2003
Posts: 425
You can't use rownum with > operator. What you are trying to do is pagination.

select * from
(select rownum as row_seq, t.* from table t where rownum < :upperbound )
where row_seq between :lowerbound and :upperbound
Shailesh Chandra
Ranch Hand

Joined: Aug 13, 2004
Posts: 1081

I would recommend that you read about analytical functions of oracle. RANK DENSE_RANK , and ROW_NUMBER would help you much in this regard.

Shailesh


Gravitation cannot be held responsible for people falling in love ~ Albert Einstein
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: oracle record fetch