I need to do the following.
- Select count for all tables under a schema. I do this with:
select table_name,
to_number(extractvalue(xmltype(
dbms_xmlgen.getxml('select count(*) X from SCHEMA.'||table_name))
,'/ROWSET/ROW/X')) as count
from all_tables tables where owner = 'SCHEMA' order by 1,2;
It gives two columns: a table name and current row count.
Store the results of this select in a variable.
Then insert some rows in several tables from an external interface.
Do the above select again.
- And diff the results, showing only the tables that were affected.
I tried with the following, but it gives error:
"too many arguments"
declare name VARCHAR2(100);
begin
select (
select table_name,
to_number(extractvalue(xmltype(
dbms_xmlgen.getxml('select count(*) X from SCHEMA.'||table_name))
,'/ROWSET/ROW/X')) as count
from all_tables tables where owner = 'SCHEMA'
)
into name
from dual;
end;