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!

I need a resultset with 10 rows from dual

Gerd VolbergJun 17 2004 — edited Jun 23 2004
Which is the easiest SELECT I have to write, when the question is: "I need a resultset with 10 rows from dual"

one solution is
SELECT 'X' FROM EMP WHERE ROWNUM <= 10;

problem: if emp has fewer than 10 rows, I have an incorrect resultset

another problem: if I need 1000 and not 10 dummy-rows, than is emp definitely the wrong way, because the default-emp table has only 14 rows.

Is there an easy generic solution for this problem? If I need only one row, Oracle has the workaround with the DUAL-table.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 21 2004
Added on Jun 17 2004
18 comments
1,890 views