|
Rownum with 1 [message #388827 is a reply to message #388824] |
Thu, 26 February 2009 05:46   |
ramesh55.sse
Messages: 262 Registered: December 2008 Location: Hyderabad
|
Senior Member |
|
|
select * from emp where rownum=1;
why rownum works only with 1,why it's not working with other than 1 ?
|
|
|
|
|
Re: Rownum with 1 [message #388843 is a reply to message #388827] |
Thu, 26 February 2009 06:19  |
JRowbottom
Messages: 5933 Registered: June 2006 Location: Sunny North Yorkshire, ho...
|
Senior Member |
|
|
Rownum is assigned to a row as it is fetched from the database.
So,if you're looking for rownum >5, Oracle will get the first row, see the it's got rownum 1, and discard it.
It will then get the next row, see that it hasn't got any rows yet, give this onw a rownum of 1, check to see if it'srownum is > 5, and discard the row.
Repeat until out of rows.
|
|
|