Home » SQL & PL/SQL » SQL & PL/SQL » Getting Columns Selected Via A Query Dynamically (Oracle9i,9.2.0.6.0,Windows XP)
Getting Columns Selected Via A Query Dynamically [message #310947] Wed, 02 April 2008 23:21 Go to next message
rajatratewal
Messages: 507
Registered: March 2008
Location: INDIA
Senior Member
Dear All,

Is their any way to get the number of columns selected via a sql query dynamically.

For Example:-

If i have a select query which select 200 columns from a table.
Is their any way to get number 200 i.e no of columns selected in SQL query dynamically.

select count(1) from (<query which select 200 columns from a table>) 

That will result 200

Regards,
Rajat Ratewal


Re: Getting Columns Selected Via A Query Dynamically [message #310973 is a reply to message #310947] Thu, 03 April 2008 00:17 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Not directly in SQL.
You have to use dbms_sql to parse your statement and then the number of columns from it.

Regards
Michel

[Updated on: Thu, 03 April 2008 00:18]

Report message to a moderator

Re: Getting Columns Selected Via A Query Dynamically [message #311081 is a reply to message #310973] Thu, 03 April 2008 06:48 Go to previous messageGo to next message
rajatratewal
Messages: 507
Registered: March 2008
Location: INDIA
Senior Member
Dear Michel,

Can you please provide some example.

Cheers,
Rajat Ratewal
Re: Getting Columns Selected Via A Query Dynamically [message #311083 is a reply to message #311081] Thu, 03 April 2008 06:50 Go to previous messageGo to next message
pablolee
Messages: 2834
Registered: May 2007
Location: Scotland
Senior Member
rajatratewal wrote on Thu, 03 April 2008 12:48
Dear Michel,

Can you please provide some example.

Cheers,
Rajat Ratewal

He did, read the link that he posted.
Re: Getting Columns Selected Via A Query Dynamically [message #311103 is a reply to message #311083] Thu, 03 April 2008 07:16 Go to previous message
rajatratewal
Messages: 507
Registered: March 2008
Location: INDIA
Senior Member
Thanks you very much I found the script in it.

Regards,
Rajat Ratewal
Previous Topic: performance in Context switch
Next Topic: show sum
Goto Forum:
  


Current Time: Sat Dec 03 12:15:39 CST 2016

Total time taken to generate the page: 0.04179 seconds