File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Paging-Query based Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Paging-Query based" Watch "Paging-Query based" New topic

Paging-Query based

Atul Mishra
Ranch Hand

Joined: Jun 08, 2006
Posts: 140

I have decided to implement query based paging for my huge report which can return large resultsets and now I need help with implementation.

In Oracle I learned about ROWNUM keyword. And I read articles about using ORDER BY DESC..

have anyone implemented this in Oracle ? If so, can you help ?

Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
I've used "select ... rownum() where rownum < nnn" in Oracle for this kind of thing. It's been years ... that's probably not exactly the right syntax. Today I had to learn "FETCH FIRST nnn ROWS ONLY" for DB2. ORDER BY might make the database engine fetch all rows and sort them before giving you the count you want so you may not save much.

Here are some notes from prior conversations about paging ...

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
I agree. Here's the link:
subject: Paging-Query based
It's not a secret anymore!