declare
cursor cur is select * from dba_objects where owner='TONY ' and object_type='TABLE ';
tableinfo dba_objects%rowtype;
sqltext varchar2 (1000);
tablenum number;
begin
open cur;
loop
fetch cur into tabeinfo;
exit when cur%notfound;
sqltext:='select count(1) from :name into tablenum ';
execute immediate sqltext using tableinfo.object_name;
dbms_output.putline(tableinfo.object_name||'number is: || tablenum );
end loop;
close cur;
end;
cursor cur is select * from dba_objects where owner='TONY ' and object_type='TABLE ';
tableinfo dba_objects%rowtype;
sqltext varchar2 (1000);
tablenum number;
begin
open cur;
loop
fetch cur into tabeinfo;
exit when cur%notfound;
sqltext:='select count(1) from :name into tablenum ';
execute immediate sqltext using tableinfo.object_name;
dbms_output.putline(tableinfo.object_name||'number is: || tablenum );
end loop;
close cur;
end;
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/30201626/viewspace-1585243/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/30201626/viewspace-1585243/