declare p_rows number; p_sql varchar(4000); begin DBMS_OUTPUT.ENABLE (buffer_size=>null); for r in (select TABLE_NAME from user_tables order by table_name) loop p_sql:='select count(1) from '||r.table_name; execute immediate p_sql into p_rows; if p_rows>0 then dbms_output.put_line(r.table_name||','||p_rows); end if; end loop; end;