Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: How to do this as a singleton select?
AND COLUMN_NAME IN ('first column name','second column name','third column
name','fourth column name')
Rich X. Woodland.
Magic Interface, Ltd.
Ryan Gaffuri wrote:
> I cant remember how to do this as one select statement.
>
> SELECT TABLE_NAME
> FROM USER_TAB_COLUMNS
> WHERE TABLE_NAME = p_tableName(this is a variable passed in)
> and COLUMN_NAME = ... however, there are 4 column_names and all of
> them have to appear.
>
> I know I can do it with 4 implicit cursors and just pass the results
> to the next, but how do I do it with a subquery?
>
> SELECT column
> into v_column
> from table
> where column = 'A'
>
> select column
> into v_column2
> from table
> where column = v_column
>
> and so on...
>
> I know its basic, but I cant remember how to do this. Went brain dead.
Received on Wed Jan 08 2003 - 13:34:23 CST