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

Home -> Community -> Usenet -> c.d.o.misc -> Ordering select results without ORDER BY

Ordering select results without ORDER BY

From: Ted O'Connor <google_at_toconnor.com>
Date: 11 Dec 2001 06:23:20 -0800
Message-ID: <4b29c484.0112110623.16b40104@posting.google.com>


I have some vendor code that I am supporting that has some incorrect SQL. Currently it is trying to get the lowest available check number from a checks table using the following SQL:

    select * from checks
    where rownum = 1 and check_status = 'A'     order by check_no

I know this returns the wrong number since the rownum is being applied before the order by. I have fixed the SQL but cannot apply the code change for two weeks because of a server migration. In the meantime is there any way I can order the checks table physically by check_no (not currently a key or index) so the above SQL will return the correct result?

Thanks. Received on Tue Dec 11 2001 - 08:23:20 CST

Original text of this message

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