前端之家收集整理的这篇文章主要介绍了
Oracle动态SQL查询,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
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;