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

Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL SELECT problem

Re: SQL SELECT problem

From: Mserban <mserban_at_aol.com>
Date: 1997/04/27
Message-ID: <19970427060500.CAA13352@ladder01.news.aol.com>#1/1

You cannot do it directly (this how a relational database works), but you may be able to do it in a roundabout way, as follows:

SPOOL myfile.sql

SELECT 'SELECT '||column_name||' FROM '||table_name||';' FROM user_tab_columns
WHERE table_name='your_table_name'
AND column_id=2;

SPOOL OFF Then run the SQL file you just created: @myfile[.sql].

If you are the owner/creator of the table, this should do it; otherwise, you may have to use the DBA_TAB_COLUMNS or ALL_TAB_COLUMNS tables and stick the OWNER column both in the SELECT and the WHERE clause.

I hope this helps.

Michael Serbanescu
Sr. Consultant, MIACO Corporation Received on Sun Apr 27 1997 - 00:00:00 CDT

Original text of this message

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