Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: problem using ROWNUM and ORDER BY clause together
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
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
- text/plain attachment: ESPN_Disclaimer.txt
![]() |
![]() |