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: problem using ROWNUM and ORDER BY clause together

RE: problem using ROWNUM and ORDER BY clause together

From: Jamadagni, Rajendra <Rajendra.Jamadagni_at_espn.com>
Date: Thu, 30 May 2002 12:29:58 -0800
Message-ID: <F001.0047041C.20020530122958@fatcity.com>


When you use rownum < 2 you are effectively selecting only one row and stopping after that. Also This is not the right way to do it, the right way is to use inline view with rownum condition and order by in outer query.

In your scenario, oracle will retrieve 2 rows and then sort them. These two rows can be anything and are not affected by the order by clause YET.

Ordering one row reminds of an assignment we had in our Graphics class, we were asked to implement object rotation, a colleague complained his program is right, but the object wasn't getting rotated. When we had a look on his screen, he was trying to rotate a circle !

Raj



Rajendra Jamadagni MIS, ESPN Inc.
Rajendra dot Jamadagni at ESPN dot com
Any opinion expressed here is personal and doesn't reflect that of ESPN Inc.

QOTD: Any clod can have facts, but having an opinion is an art!

-----Original Message-----
Sent: Thursday, May 30, 2002 4:08 PM
To: Multiple recipients of list ORACLE-L

problem is it works if we have rownum < 3(or any value >2) and only fails if we use rownum < 2...


-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Jamadagni, Rajendra
  INET: Rajendra.Jamadagni_at_espn.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 Thu May 30 2002 - 15:29:58 CDT

Original text of this message

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