Home » SQL & PL/SQL » SQL & PL/SQL » Sequencial Incremental Rows result (oracle 9i or 10g)
Sequencial Incremental Rows result [message #332940] Thu, 10 July 2008 03:03 Go to next message
agassis
Messages: 4
Registered: June 2008
Location: UK
Junior Member

I need to select say first 10 rows and the same query should return next sequencial 10 rows when i execute again ,

Pls.let me know if this is possible in oracle

example :

SELECT id
FROM TABLEA
WHERE rownum <=10
ORDER BY id

first time execution result1 : 1,2,3,4,5,6,7,8,9,10

next time the query should result in

second time execution result2 : 11,12, 13,14,15,16,17,18,19,20

Your comments & sugesstion are much appreciated. Let me know if this is not clear.Thanks
Re: Sequencial Incremental Rows result [message #332946 is a reply to message #332940] Thu, 10 July 2008 03:10 Go to previous messageGo to next message
rleishman
Messages: 3724
Registered: October 2005
Location: Melbourne, Australia
Senior Member
The query you have will not work because the ROWNUM applies BEFORE the ORDER BY.

I recall that there is a pretty thorough discussion on returning results in "pages" to applications on http://asktom.oracle.com Do a search

Ross Leishman
Re: Sequencial Incremental Rows result [message #332952 is a reply to message #332940] Thu, 10 July 2008 03:16 Go to previous message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
SQL Reference
Chapter 3 Pseudocolumns
Section ROWNUM Pseudocolumn

Regards
Michel
Previous Topic: insert with mutilple parameter
Next Topic: Reg Updating a column with the sequence number (merged)
Goto Forum:
  


Current Time: Sat Dec 03 18:01:47 CST 2016

Total time taken to generate the page: 0.04400 seconds