Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: How to get proper SQL query?
You need to use dynamic sql.
Tom
Gennady <gennadyb_at_halcosoftware.com> wrote in message
news:394e5ffd$0$2939_at_fountain.mindlink.net...
> Hello,
> I'd like to create a query on table which has 20 fields (F1,F2,...F20) to
> run it in SQL Work Sheet, but
> I need to exclude five fields from the query and I can't use rest of
fields
> explicitly.
> So instead of using this:
> SELECT F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12,F13,F14,F15,F16
> FROM MYTABLE;
> I try to 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')),NULL
> FROM MYTABLE;
> But it doesn't work.
> How could I fix last expression to get proper result?
> Thanks,
> Gennady
>
>
>
Received on Tue Jun 20 2000 - 00:00:00 CDT