Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: How to accessing columns of a query-result by index

Re: How to accessing columns of a query-result by index

From: Pratap <pratap_fin_at_rediffmail.com>
Date: 20 Sep 2005 04:00:53 -0700
Message-ID: <1127214053.707115.293050@z14g2000cwz.googlegroups.com>


Two ways to do this (They have their limitations though) -

  1. 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
  2. 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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US