Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Select Columns from Another table columns values

Srikkanth MJul 27 2023

Dear All,

Am trying to get the columns names from another table columns values. Here with i have give the example which i was trying to achieve.

Structure of Table A& B

TableA

ID NAME1 NAME2 NAME3 NAME4 NAME5

TableB

ID NAME1 NAME2 NAME3 NAME4 NAME5

Another Table contains value of Columns name of Table A & B.

Table_columns

Col_name table_name col_name1 table_name1

ID TABLEA ID TABLEB

NAME1 TABLEA NAME1 TABLEB

NAME2 TABLEA NAME2 TABLEB

My requirement is, when we ran the query to find the difference between TABLEA & TABLEB, need to select only the columns Present in the table TABLE_COLUMNS i.e columns ID,NAME1,NAME2 and not the other columns mean some thing as dynamically.

Am trying to achieve by using select statement but can't. Could some one help on this.

As this can be achievable using Execute immediate, but my requirement is to compare the columns values then insert into another table which is quite complex using execute immediate. So i trying to achieve using select statement.

Thanks & Regards

Sri M

Comments
Post Details
Added on Jul 27 2023
6 comments
1,416 views