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!

Generating rows without using a dummy table

KevinDClarkeNov 3 2005 — edited Nov 7 2005
Earlier this week I attended a presentation by Tom Kyte and learnt a method to generate rows which I have not seen before. I wrote his example down wrong but after some googling I have found something similar. It appears to be an excellent method but I just can't understand why it works:

SQL> select numbers.num from
2 (select rownum num
3 from dual
4 connect by rownum <6 ) numbers;

NUM
----------
1
2
3
4
5

SQL> select rownum num
2 from dual
3 connect by rownum <6 ;

NUM
----------
1

Can anyone please explain how the first example works, and also why the second does not produce the same result ?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 5 2005
Added on Nov 3 2005
21 comments
1,319 views