Home » SQL & PL/SQL » SQL & PL/SQL » Display 2 constant values as rows using one select statement!!
Display 2 constant values as rows using one select statement!! [message #200908] Wed, 01 November 2006 19:19 Go to next message
Sushilkumar.T
Messages: 8
Registered: November 2004
Junior Member
Hi,

I was just trying to display 2 constant values as rows using one single SELECT statment.

I am aware that this can be achieved using 'UNION' SET operation.
i.e,

SELECT 'APPLE' FROM dual
UNION
SELECT 'ORACLE' FROM dual

o/p:
===============
APPLE
ORACLE

Question:
But is it possible to achieve it using just One SELECT statement.

Made me think, ANybody any thoughts on this???

Thanks,
Sushil
Re: Display 2 constant values as rows using one select statement!! [message #200912 is a reply to message #200908] Wed, 01 November 2006 20:00 Go to previous messageGo to next message
rleishman
Messages: 3724
Registered: October 2005
Location: Melbourne, Australia
Senior Member
Here's 2 ways.
select decode(rownum, 1, 'APPLE', 2, 'ORACLE')
from dual
connect by level <= 2


select column_value
from table(sys.dbms_debug_vc2coll('APPLE','ORACLE'))


Ross Leishman
Re: Display 2 constant values as rows using one select statement!! [message #202658 is a reply to message #200912] Fri, 10 November 2006 14:16 Go to previous message
Sushilkumar.T
Messages: 8
Registered: November 2004
Junior Member
Ross,

It works, Thank you!!!

Appriciate your prompt response.

Regards
Sushil
Previous Topic: Getting PROBE TIMEOUT Error....please help me out...It is urgent
Next Topic: retrieve last row inserted
Goto Forum:
  


Current Time: Sat Dec 03 03:58:31 CST 2016

Total time taken to generate the page: 0.13077 seconds