declare
count_limit number := 10000;
query_string varchar2(100) := 'select count(1) from ';
total_count number;
cursor c_query_user_tables is
select table_name
from user_tables
where table_name like 'T%'
order by table_name;
begin
for atable in c_query_user_tables loop
execute immediate query_string || atable.table_name into total_count;
if total_count >= count_limit then
dbms_output.put_line(atable.table_name || ' ' || total_count);
end if;
end loop;
end;Oracle动态SQL查询
最新推荐文章于 2024-09-13 08:02:47 发布
本文介绍了一段PL/SQL代码,该代码用于批量查询以T开头的所有表的记录总数,并设置了一个阈值为10000,当表中的记录数超过此阈值时,将输出表名及其记录数。
1128

被折叠的 条评论
为什么被折叠?



