例如:
SQL> declare
  2  v_out number;
  3  cursor v_c is select table_name from user_tables where table_name like '%T%';
  4  begin
  5  for i in v_c loop
  6    execute immediate 'select count(*) from '||i.table_name into v_out;
  7    if v_out<>0 then
  8       dbms_output.put_line(i.table_name||' rows:'||v_out);
  9    end if;
 10  end loop;
 11  end;
 12  /
ACCOUNT rows:5
DEPT rows:4
RECEIPT rows:1
T rows:3
TB rows:8PL/SQL 过程已成功完成。已用时间:  00: 00: 00.42
SQL>