I want to count number of rows for all tables in user-defined schemas. I have got solution related to specific schema counts. But I want to get the following output
TABLE_NAME SCHEMA_NAME ROW_COUNT
The main concern is ALL USER-DEFINED SCHEMAS ONLY. I can't figure out that how to identify that whether it's user schema or system schema. Moreover, when I execute following script
declare
v_count integer;
begin
for r in (select table_name, owner from all_tables where owner not in ('SYS','SYSTEM','OUTLN','DBSNMP','APPQOSSYS','WMSYS','CTXSYS','XDB' ) )
loop
execute immediate 'select count(*) from ' || r.table_name
into v_count;
DBMS_OUTPUT.PUT_LINE(r.table_name ||v_Count);
INSERT INTO STATS_TABLE(TABLE_NAME,SCHEMA_NAME,RECORD_COUNT)
VALUES (r.table_name,r.owner,v_count);
end loop;
end;
But it returned following error
Error report - ORA-00942: table or view does not exist ORA-06512: at line 7 00942. 00000 - "table or view does not exist" *Cause:
*Action:
Thanks in advance for valuable responses.