Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: SQL query?
Gennady wrote :
>
> Hello,
> I'd like to create a query on table which has 20 fields (F1,F2,...F20), but
> I need to exclude five fields from the query and I can't use rest of fields
> explicitly.
> So I try do that like :
> SELECT (SELECT COLUMN_NAME||',' FROM USER_TAB_COLUMNS
> WHERE TABLE_NAME='MYTABLE' AND COLUMN_NAME NOT IN
> ('F1','F17','F18','F19','F20'))
> FROM MYTABLE;
> But it doesn't work.
> How could I fix this expression to get proper result?
> Thanks,
> Gennady
If you're using SQL+, try this :
set heading off feedback 0
spool my_query.sql
prompt SELECT
select COLUMN_NAME||',' FROM USER_TAB_COLUMNS
where TABLE_NAME='MYTABLE' and COLUMN_NAME not in
('F1','F17','F18','F19','F20');
prompt NULL
prompt FROM MY_TABLE;
spool off
set heading on feedback 1
start my_query
-- Pierre CHARPENAYReceived on Fri Jun 16 2000 - 00:00:00 CDT
![]() |
![]() |