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!

SQL- ROWNUM

706043Dec 24 2009 — edited Dec 25 2009
Hello All and Happy Holidays....I just wanted to get a better understanding of ROWNUM, I was reading about ROWNUM in oracle discussion and was a little confuse.

If I have the following:
select customer1.cus_id,customer1.cus_name,customer_phone1.phone_id,phone1.phone_num,phone_location1.phone_id,phone_location1.loc_id,location1.loc_area
from
customer1 inner join customer_phone1 on customer1.cus_id=customer_phone1.cus_id
inner join phone1 on customer_phone1.phone_id=phone1.phone_id
inner join phone_location1 on phone_location1.phone_id=phone1.phone_id
INNER JOIN location1 on phone_location1.loc_id=location1.loc_id
where rownum<=100;

What I am trying to do is get all the tables to join , but once it join 100 rows, I want it to exit.
Not sure if the above code is correct or maybe I should put bracker after the FROM and before the WHERE clause?
Any recommendation?

thanks ,
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 22 2010
Added on Dec 24 2009
4 comments
931 views