Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SELECT TOP 1 .... ORDER BY

443470Oct 14 2005 — edited Oct 17 2005
Hi,

I have the following statement in SQL SERVER:

SELECT TOP 1 NAME FROM STUDENT ORDER BYGRADE

Now, I am trying to translate it ti ORACLE PLSQL, I came up with this statement:

SELECT NAME FROM STUDENT WHERE ROWNUM=1 ORDER BY GRADE

It doesn't work. I guess ORACLE generates ROWNUM before the ORDER BY operation...

How can I have SELECT TOP N ... ORDER BY ... in Oracle the way that I have it in SQL server?

Any help would be apprecited,
Alan
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 14 2005
Added on Oct 14 2005
12 comments
90,883 views