Thread: rownum in 9i
View Single Post
  #4 (permalink)  
Old 10-03-2007, 01:03 PM
Unregistered
 
Posts: n/a
Default ANY answer. Re: rownum in 9i

when u execute the SQL statement it always execute with 1 as rownum.
for ex :
select * from emp where rownum>=3;
this statement, when executes first time rownum is 1.next time rownum is 2...soon.
Sequence of Steps for Executing above SQL Statement:

select * from emp where 1>=3; - True
select * from emp where 2>=3; - True
select * from emp where 3>=3; - True
select * from emp where 4>=3; - False

the query executes 3 times and 3 rows will dispaly.


but when run following statement ,
select * from emp where rownum=2;

Sequence of Steps for Executing above SQL Statement:

select * from emp where 1=2;which is false.
hence it returns 0 rows.

So Note that while Executing SQL Statement with Rownum it Always start from 1(i.e) first row..
Reply With Quote