Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Referencing columns by their position in a table ??
If you are constructing a query using dbms_sql, it is possible otherwise no
(well not to my knowledge) ;-(
You can pick the column ok...
select column_name from (select rownum rn, column_name from
user_tab_columns
where table_name = 'EMP')
where rn = 2;
COLUMN_NAME
SQL> select empno, (select column_name from
2 (select rownum rn, column_name from user_tab_columns
3 where table_name = 'EMP') name
4 where rn = 2);
5 from emp
select empno, (select column_name from
*
ERROR at line 1:
ORA-00936: missing expression
Mark
Matt Randle wrote in message
<931349966.7333.0.nnrp-12.d4e48d0d_at_news.demon.co.uk>...
>Can anyone tell me if there's a way of specifying a column to retrieve as
>part of a select statement by the position of the column in the table.
>
>For example, a have a table where I know I want to retrieve the 2nd column
>but I do not know what the column is called ??
>
>Thanks,
>
>Matt.
>
>
>
Received on Wed Jul 07 1999 - 08:58:10 CDT