Several rows from Dual

From: Hans Mayr <mayr1972_at_gmx.de>
Date: Thu, 12 Feb 2009 09:33:18 -0800 (PST)
Message-ID: <630331ba-b67b-46bf-8bc0-e6c153cb1b5f_at_v19g2000yqn.googlegroups.com>



Hello,

for some reason I need something like a "select 123 as abc from dual;" but with several result rows rather than one. The result should look like

ABC
123
456
789

So I came up with the following solution which seems akward to me:

SELECT
     abc
FROM

     (SELECT level abc FROM dual CONNECT BY level <= 999
     )
WHERE
     abc IN(123, 456, 789) ;

It was essential to me that I could easyly change the number of results like here through just writing them between the brackets, otherwise I could have used a UNION statement. But my solution looks ugly, especially the "<=999" because I will need it for bigger than 3 digit numbers. Does anybody know a better solution?

Thanks and best,

Hans Received on Thu Feb 12 2009 - 11:33:18 CST

Original text of this message