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

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Why this SQL does not work?

RE: Why this SQL does not work?

From: Kevin Lange <kgel_at_ppoone.com>
Date: Wed, 11 Jul 2001 13:42:04 -0700
Message-ID: <F001.00348006.20010711135944@fatcity.com>

First guess .... There are only 4 rows of data returned ??

Change the first query to

  Where rownum <= 5

and let us know if you actually get that 5th row. If you did not then I would say that the queries are both working but there are only 4 rows that match the criteria.

-----Original Message-----
Sent: Wednesday, July 11, 2001 4:44 PM
To: Multiple recipients of list ORACLE-L

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
Maheswara.Rao_at_Sungardp3.com

--

Please see the official ORACLE-L FAQ: http://www.orafaq.com
--

Author: Rao, Maheswara
  INET: Maheswara.Rao_at_Sungardp3.com

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: ListGuru_at_fatcity.com (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: Kevin Lange
  INET: kgel_at_ppoone.com
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: ListGuru_at_fatcity.com (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). Received on Wed Jul 11 2001 - 15:42:04 CDT

Original text of this message

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