Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: select job from user_jobs where rownum=? Please help

Re: select job from user_jobs where rownum=? Please help

From: C. Ferguson <c_ferguson_at_rationalconcepts.com>
Date: 2000/08/04
Message-ID: <398B5019.5ABE02C4@rationalconcepts.com>#1/1

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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US