----------将owner.table_name插入到test表中,在protest表中可以得到相应统计结果
create or replace procedure testtt as
cursor test_cursor is select a from test;
v_sql1 varchar(500);
begin
execute immediate 'truncate table protest';
for c in test_cursor loop
v_sql1:='insert into protest select '''||lower(c.a)||''' ,count(*) from '|| lower(c.a);
dbms_output.put_line(v_sql1);
execute immediate v_sql1;
end loop;
commit;
exception
when others then
dbms_output.put_line('errors,please check test table');
end testtt;