Home » SQL & PL/SQL » SQL & PL/SQL » using column name returned by nested select (Database 10g)
using column name returned by nested select [message #441101] Thu, 28 January 2010 15:30 Go to next message
lydianblues
Messages: 5
Registered: January 2010
Junior Member

I have a select statement that returns a column name. I want to use it as a nested select:

SELECT (<inner select that returns a column name goes here>)
FROM my_table;

Of course, this won't work. It just prints out the column name for each row in my_table. How can I force the column name string to be interpreted as an identifier?
Re: using column name returned by nested select [message #441103 is a reply to message #441101] Thu, 28 January 2010 15:45 Go to previous messageGo to next message
Littlefoot
Messages: 20827
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
It is dynamic SQL what you are looking for; at least, that's what I figured out of your question. IF so, check use of EXECUTE IMMEDIATE.
Re: using column name returned by nested select [message #441131 is a reply to message #441101] Thu, 28 January 2010 23:16 Go to previous message
Michel Cadot
Messages: 63806
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
In addition, if you post the actual need you try to fullfil we can tell ways to achieve.
Here you only post the way you want to achieve it and just can provide a limited help.

Regards
Michel
Previous Topic: last_value not working in Oracle 9i
Next Topic: Stream URL to BLOB (merged 5)
Goto Forum:
  


Current Time: Tue Sep 27 19:33:00 CDT 2016

Total time taken to generate the page: 0.11622 seconds