0

I have a table with names of other tables. How can I create a query that gets the table from the values?

For example, if my table has the values:

tables
------
users
users2
users3

I want to create Dynamic SQL function that knows how to take the values (i.e. the table names) from the reference table and then select * from that named value.

4

1 回答 1

0

如果您只想要一个一次性脚本,您可以运行查询:

select 'select * from ' || table_name || ';' cmd
from user_tables;

然后运行输出

于 2012-12-06T15:46:32.943 回答