• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Pagination of Oracle database query resulet

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My query retrieves more than 5000 records from Oracle database. I want to display the records 100 per page. I know it is called pagination. Any detailed styp-by-guide or tutorial or example available?
 
Rancher
Posts: 4801
50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here's Tom Kyte's article from several years ago about using ROWNUM and Top-N for pagination in Oracle.
Look for the section "Pagination with ROWNUM" about half way down.
 
Sheriff
Posts: 5555
326
IntelliJ IDE Python Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As a side note: I would seriously question the value of presenting over 5000 records on the UI, paginated or not. No user is going to look at every single one.
 
Dave Tolls
Rancher
Posts: 4801
50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Cooke wrote:As a side note: I would seriously question the value of presenting over 5000 records on the UI, paginated or not. No user is going to look at every single one.



That's the reason for pagination, surely?
So you're only displaying a subset of the results.

That's what Google does, after all.
 
Bartender
Posts: 1810
28
jQuery Netbeans IDE Eclipse IDE Firefox Browser MySQL Database Chrome Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I always recommend the jQuery plugin DataTables. It will make this a lot simpler. It does the pagination for you, lets the user select how many records they want displayed, will process the records on the server side returning only as many as need to be displayed, provides column sorting, it's theme-able with jQuery UI and other features too numerous to list.

I'm not associated with the product, I just use it a lot.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'd suggest only retrieving as many rows as you are yogin to display. Why fetch 5000 rows if you are only going to show 100? There are SQL clauses to "slice" the data that is returned by the result set (depends upon database), and JPA methods to do the same.
 
Dave Tolls
Rancher
Posts: 4801
50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:I'd suggest only retrieving as many rows as you are yogin to display. Why fetch 5000 rows if you are only going to show 100? There are SQL clauses to "slice" the data that is returned by the result set (depends upon database), and JPA methods to do the same.



Which is exactly what the Ask Tom page I linked to shows you how to do.
Attempting to show everything is a short hop from a padded room and a coat with long arms.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Agreed. And any large data set without filtering ability is a recipe for a straight-jacket.
reply
    Bookmark Topic Watch Topic
  • New Topic