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!

rownum greater than query

XenofonApr 14 2010 — edited Apr 14 2010
Hi all,

first of all, what I am aware about...

I am aware about the fact, that ROWNUM filters, inside the query which is to be filtered by rownum, are incorrect. That is this is incorrect:

select * from <table> where rownum < 20;

Also I am aware, that the following will never return a result:

select * from <table> where rownum > 20;

That is clear. The correct version of the "less than" query is:

select * from (select * from <table> order by a) where rownum < 20;

Now the question: what does the last example still not work with "greater than" queries:

Take e.g. following example:

select * from (
select * from dba_objects order by object_name
) where rownum > 5
;
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 12 2010
Added on Apr 14 2010
9 comments
11,306 views