Não sei se te adianta, mas quando coleta estatistica você tem uma quantidade de
linhas aproximadas em um dos campos
da DBA_TABLES.
Te digo isso, porque apesar de que esse select seu funcione, se a tabela for
muito grande vai demorar muito e no caso,
da DBA_TABLES vai ter o numero aproximado de li
Roda este script no Sql Plus que funciona direitinho.
DECLARE
nLinhas number := 0;
cTable VARCHAR2(100) := 'a' ;
CURSOR CUR_TBLS IS
SELECT TABLE_NAME
FROM USER_TABLES;
BEGIN
DBMS_OUTPUT.put_line('---');
OPEN CUR_TBLS;
FETCH CUR_TBLS
INTO cTable;
while((CUR_TBLS%FOUND)) LOOP
Declare
vv_string varchar2(32767);
vv_tabela varchar2(100) := 'dual'; vt_aux dbms_sql.number_table;
begin
vv_string := 'select 1 from '||vv_tabela;
execute imediate vv_string bulk collect into vt_aux;
for i in vt_aux.first .. vt_aux.last
loop
...
end lo