--循环字典导表记录(最好把输出缓冲区的值设大一点)
Declare
v_cnt Number := 0;
v_num_rows Number;
v_owner Varchar2(50):='NEWDB';
v_sql Varchar2(4000);
Begin
v_num_rows := 0;
For rec In (Select d.table_name From dba_tables d
Where d.owner='NEWDB' And d.table_name Like 'T_%'
Order By d.table_name) Loop
v_sql:= 'Select Count(Rowid) From '||v_owner||'.'||rec.table_name;
execute Immediate v_sql Into v_num_rows ;
v_cnt:=v_cnt+1;
dbms_output.put_line(v_cnt||chr(9)||rec.table_name||chr(9)||v_num_rows);
End Loop;
End;
/
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/183473/viewspace-675743/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/183473/viewspace-675743/