The way I understand it is rownum does not exist until the data set is 
returned.  The first row returned therefore is rownum = 1 because it is the 
first row in the dataset, but you are looking for rownum = 5, so it throws 
that one away.  The next row is returned and again is rownum = 1 because it 
is now the first row in the dataset, but again you are looking for rownum = 
5, so it throws that away too.  And so on and so on.  Basically, it never 
gets to rownum = 5.  So you can use rownum = 1 or rownum < anything more 
than 1, but nothing else.

At 01:44 PM 7/11/01 -0800, you wrote:
>List,
>
>Following are two SQL statements.  The first SQL statement works OK (where
>ROWNUM < 5 is used). The second SQL statement does not return any rows
>(where ROWNUM = 5 is used).  This table contains 200 records.
>
>First SQL statement
>-------------------
>SELECT * FROM
>   (SELECT PROCESSED_DATE
>      FROM TRADES WHERE PROCESSED_STATUS = 0
>           ORDER BY ENTRY_DATE)
>   WHERE ROWNUM < 5
>
>Second SQL statement
>--------------------
>SELECT * FROM
>   (SELECT PROCESSED_DATE
>      FROM TRADES WHERE PROCESSED_STATUS = 0
>           ORDER BY ENTRY_DATE)
>   WHERE ROWNUM = 5
>
>---------------
>Question:
>
>Why second SQL statement does not work?
>
>I would be thankful for the clarification.
>
>Thanks,
>
>Rao
>[EMAIL PROTECTED]
>
>--
>Please see the official ORACLE-L FAQ: http://www.orafaq.com
>--
>Author: Rao, Maheswara
>   INET: [EMAIL PROTECTED]
>
>Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
>San Diego, California        -- Public Internet access / Mailing Lists
>--------------------------------------------------------------------
>To REMOVE yourself from this mailing list, send an E-Mail message
>to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
>the message BODY, include a line containing: UNSUB ORACLE-L
>(or the name of mailing list you want to be removed from).  You may
>also send the HELP command for other information (like subscribing).

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Regina Harter
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

Reply via email to