Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: help with query :)
Actually, it's true, ROWNUM goes before order by, so it orders the first
10 rows it retrieves, but it's not guaranteed to return the latest
inserted records.
But since I'm programming in java, I can just set a counter up to 10, so that solves the problem, although not elegant and efficient, for now it satisfies my needs.
Thank you all for your responses
--Yohans
Yohans Mendoza System Analyst yohans_at_sirius-images.com Sirius Images Inc. http://www.sirius-images.net/users/yohans http://www.sirius-images.com ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
On Fri, 2 Jun 2000, Abdul Aleem wrote:
> This_is_strange, because I have tried the following two queries on the Scott
> demo table Emp and it worked. Let's see what Yohans says from his
> experience.
>
> Regards,
>
> Aleem
>
> Following is the result from both queries.
>
> SELECT EmpNo FROM Emp ORDER BY EmpNo DESC
> EMPNO
> ----------
> 7934
> 7902
> 7900
> 7876
> 7844
> 7839
> 7788
> 7782
> 7698
> 7654
> 7566
> 7521 In the second query
> 7499 In the second query
> 7369 In the second query
>
> SELECT EmpNo FROM Emp WHERE ROWNUM <= 3 ORDERY BY EmpNo DESC
>
> EMPNO
> ----------
> 7521
> 7499
> 7369
>
>
> -----Original Message-----
> From: Serge Kosourikhin [mailto:kosour_at_braz.ru]
> Sent: 02 June, 2000 2:22 PM
> To: Multiple recipients of list ORACLE-L
> Subject: Re: help with query :)
>
> It _shuldn't_ work, because ROWNUM works before order by, not after.
>
> Serge Kosourikhin
> Oracle DBA
> JSC Bratsk Aluminium Plant
> ----- Original Message -----
> To: Multiple recipients of list ORACLE-L <ORACLE-L_at_fatcity.com>
> Sent: Friday, June 02, 2000 4:44 PM
>
>
> > I think excellent, It should work.
> >
>
> --
> Author: Abdul Aleem
> INET: abchaudhary-ho_at_beaconhouse.edu.pk
>
> 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
Received on Fri Jun 02 2000 - 11:26:31 CDT