[英]Oracle: select * from (select table_name from … )?
Given a query that returns the name of tables, is it possible to evaluate the name and use it in a subsequent query? 给定一个返回表名的查询,是否可以评估名称并在后续查询中使用它?
EG 例如
select count(1) from x where x in
(select table_name from ALL_TABLES where table_name like 'MY_TABLE_%');
Obviously this is invalid syntax, but it should illustrate what I'm trying to do. 显然这是无效的语法,但它应该说明我正在尝试做什么。
try to use something like 试着用类似的东西
select table_name
into table_name_value
from ALL_TABLES where table_name like 'MY_TABLE_%');
execute immediate 'select count(1) from ' || table_name_value into returned_value;
and adopt it into your loop 并将其纳入你的循环中
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.