Re: Newbie question about rownum

From: Prasad Yarlagadda <prasad.yarlagadda_at_motorola.com>
Date: Wed, 6 Mar 2002 14:35:15 -0600
Message-ID: <a65ui4$7b99_at_nntp.cig.mot.com>


Conditions testing for ROWNUM values greater than a positive integer are always false. For example, this query returns no rows:

SELECT * FROM emp
WHERE ROWNUM > 1;
The first row fetched is assigned a ROWNUM of 1 and makes the condition false. The second row to be fetched is now the first row and is also assigned a ROWNUM of 1 and makes the condition false. All rows subsequently fail to satisfy the condition, so no rows are returned.

Using the same analogy for rownum = 10, you will never get any data.

Hope this helps,
Prasad Yarlagadda

"hwchui" <hwc33_at_hotmail.com> wrote in message news:a65goi$4mb2_at_imsp212.netvigator.com...
> Hi
>
> I got a table with 14records, when I do select rownum, * from myTable
>
> 14 rownum numbers plus columns from myTable are returned.
> (the rownum is 1,2,3,...14)
>
>
> If I do select rownum,* from myTable where rownum < 10.
> 10 records returned
>
> but if I do select rownum, * from myTable where rownum > 10
> no record returned
>
>
> Why is that?
>
>
> Thanks in advance.
>
>
Received on Wed Mar 06 2002 - 21:35:15 CET

Original text of this message