Skip to content
Advertisement

Fetch data from one table columns whose names are value of another table

I need to fetch columns from a master table and the list of columns that i need to get will be in a metadata table for different users.This would need to be dynamic as each user might not have the same number of columns to be fetched.

Metadata table

Master Data table

When user rk is selected from meta table ,i would want to get only sector and industry When user pa is selected i would want to get only sector ,industry and subindustry field also.

Tried this from one more solution,but this is not dynamic.

When user rk is selected from meta table ,i would want to get only sector and industry When user pa is selected i would want to get only sector ,industry and subindustry field also.

Advertisement

Answer

One option is to use a function that returns ref cursor.

Test case:

Function:

Testing:

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