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!

where rownum=2 in my sql query is not working . Why ??

bootstrapOct 3 2011 — edited Oct 3 2011
Hello,
i am using Oracle 11g .Referring scott schema's emp table.
I just issued this sql query with the intention to get second highest salary of a employee. But i am unable to understand why my query fails ?
select rownum,empno,ename,sal from (select empno,ename,sal from emp order by sal desc) where rownum=2;
This query is returning no rows . Can you tell why this query is returning no rows ?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 31 2011
Added on Oct 3 2011
8 comments
2,854 views