Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: ROWNUM comparisons using < vs >
Jim,
I got this from the Oracle Manual
For each row returned by a query, the ROWNUM pseudocolumn returns a number
indicating the order in which Oracle selects the row from a table or set of
joined
rows.
Note that 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.
Aj
Jim.Pickett_at_cubic.com wrote in message ...
>
>Greetings Gurus -
>
>Why is it that I can use the pseudo-column ROWNUM to get row/columns
>less than a given ROWNUM value but I can't use it to get row/columns
>greater than a given ROWNUM value ?
>
>Example from the table below has +97000 rows :
>
>
>SQL> select part_nbr from part where rownum > 10;
>no rows selected
>
>SQL> select part_nbr from part where rownum < 10;
>
>PART_NBR
>-------------------------
>#.12562GROVE
>#003005BRASS
>#006-10478
>#025DRSCR
>#51618100HSS
>#51618100SCAPSS
>#51618100SCS
>#51618100SOCHD
>#51618125H
>
>9 rows selected.
>
>SQL> select count(*) from part;
>
> COUNT(*)
>----------
> 97392
>
>======================================
> Jim Pickett
> Manager of Database Administration
> Cubic Corporation
>
> Work: (619)505-2868
> Pager: (619)494-5539
> E-mail: jim_pickett_at_cubic.com
>
> 01/20/1999 07:39:31
>======================================
>
>
Received on Wed Jan 20 1999 - 18:01:15 CST
![]() |
![]() |