Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ROWNUM 1

Status
Not open for further replies.

dbomrrsm

Programmer
Feb 20, 2004
1,709
GB
Will a

Code:
Select *
from TableA
where rownum < 10

always return the same 9 rows (assuming the table hasnt changed).

TIA

[bandito] [blue]DBomrrsm[/blue] [bandito]

[blue]Software code, like laws and sausages, should never be examined in production[/blue][black] - [/black][purple]Edward Tenner[/purple]
 
DBomrrsm,

As you probably know, the zero-argument ROWNUM function does not relate to any specific rows in the table. The results from the function derive from rows that have previously entered the result set on the same query iteration.

Although a query involving ROWNUM should produce the same rows if

1) there is no change to the table and
2) there is no change to the query,

Oracle makes no assertions about those two behaviours...In other words, if you want certain/specific rows to return from the query, you should implement other WHERE-clause mechanisms, besides the ROWNUM function, to ensure the same rows comprise the query's results set.

[santa]Mufasa
(aka Dave of Sandy, Utah, USA)
[I provide low-cost, remote Database Administration services: www.dasages.com]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top