Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: select job from user_jobs where rownum=? Please help
Ok,
here's how to use ROWNUM.
ROWNUM tells you what? The order in which a row is selected from a table.
The first row selected has a ROWNUM of 1.
How? ROWNUM is incremented ONLY when a row is retrieved.
So, if you use where rownum < 2, rownum is incremented correctly and you see results.
if you use rownum = some constant, rownum is not incremented because
the first constant-1 rows are not
retrieved.
See PL/SQL User's Guide and Reference, SQL Pseudocolumns.
hth,
cindy
anurag wrote:
> Hi,
>
> When I give the following query it returns me 2 rows. But when I
> include rownum in my where clause it does not return anything.
> Please help
>
> SQL> select rownum,job from user_jobs;
>
> ROWNUM JOB
> --------- ---------
> 1 60
> 2 61
> SQL> select rownum,job from user_jobs where rownum=2;
>
> no rows selected
>
> Thanks
> Anurag
>
> -----------------------------------------------------------
>
> Got questions? Get answers over the phone at Keen.com.
> Up to 100 minutes free!
> http://www.keen.com
Received on Fri Aug 04 2000 - 00:00:00 CDT