Hello,
the system table USER_TAB_COLS gives us information about the columns of a table, including columns' internal id. I need a query to select a column from a table with a certain internal id, for example internal_column_id = 1.
So, if the query
select column_name
from user_tab_cols
where table_name = customers and internal_column_id = 1
returns "NAME", then I need the statement
select NAME from customers
Of course, I need some dynamic in the SQL, which means, that I don't know the column name when I write the second SQL statement. I need something like this:
select
(
select column_name
from user_tab_cols
where table_name = customers and internal_column_id = 1
)
from customers
The inner select statement should return NAME and this column should be selected by the outer statement.
Do you have any ideas?