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!

Execution Order in case of Rownum

Vikas KumarJul 26 2012 — edited Jul 26 2012
Hi All,

I just wanted to know how the query will be executed in case of where clause and ROWNUM clause. e.g, consider below query.

SELECT * FROM emp
WHERE dept IN (20, 30, 21)
AND salary < 10000
AND rownum <2;

My question is that when rownum will be executed?
1. First all the data according to where clause will be fetched and rownum is asigned and then rownum will be executed on that data.
2. First complete data will be fetched, ROWNUM will be applied and then WHERE clause will be executed along with ROWNUM clause.

Regards,
Vikas Kumar
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 23 2012
Added on Jul 26 2012
8 comments
1,256 views