SQL>
SQL> declare
2 olist dbms_stats.objectTab;
3 begin
4 dbms_stats.gather_schema_stats(user,cascade=>TRUE,method_opt=> 'FOR ALL INDEXED COLUMNS',options=>'GATHER STALE',objlist=>olist);
5
6 dbms_output.put_line('Objects Analyzed: ' || olist.COUNT );
7 if olist.COUNT > 0 then
8 FOR x in 1..olist.COUNT LOOP
9 dbms_output.put_line('Object Name: ' || olist(x).objname );
10 END LOOP;
11 end if;
12
13 end;
14 /
Objects Analyzed: 2
Object Name: MYSTATS
Object Name: P1
PL/SQL procedure successfully completed.
SQL>