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!

Union and Rownum

511922Sep 2 2006 — edited Sep 3 2006

Hi,

I have a query like this:

select t1,t2
from tab1
where ..

union

select t1,t2
from tab2
where...

union

select t1,t2
from tab3
where...

union

select t1,t2
from tab3
where...

Now, I just want 500 records from the above result set. will it work if I apply rownum<501 in where clause of all the queries or i will have to inline the query and takeout the rownum?

What would be the effect if i use rownum<501 in where clause of all the queries above..? and what if i use the rownum<501 in the last query's where clause only.. I tried it but giving diff results at diff times...

Thx

JP

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 1 2006
Added on Sep 2 2006
3 comments
4,277 views