Oracle动态SQL查询

来源:互联网 发布:微创软件股份有限公司 编辑:程序博客网 时间:2024/04/27 02:17
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;

0 0