Using select * --> Get the name of the columns from user_tab_columns
by finding out the table name. The text after the FROM is the table
name. If there are multiple tables then it becomes more complex. If you
have say select tab1.* then it is even more complex string processing

Using actual columns in the select list --> select col1, col2 etc -
Here you can get the string between SELECT and FROM and count the
commas in the resulting string and extract the column names. You have
to take care of column alias as well.

But there can be several cases where the logic above won't work, like
select 'string,xyz' col1, col2 etc...
Received on Tue Sep 20 2005 - 06:00:53 CDT