Skip to content
Advertisement

Select configurable column names in Oracle SQL

I have a table with configurable column names which I can query like this:

This is how ‘my_config’ tables looks like.

My other table would look like this:

However, I would be looking to select only those columns that the query above returns in my other table, kind of like the below:

How could I achieve this?

Expected result:

Advertisement

Answer

You will need a dynamic query for the list of columns. It can be something like this:

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement