Skip to content

Instantly share code, notes, and snippets.

@velppa
Created December 29, 2012 20:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save velppa/4409100 to your computer and use it in GitHub Desktop.
Save velppa/4409100 to your computer and use it in GitHub Desktop.
Prints number of rows in each table on given scheme
DECLARE
n NUMBER;
BEGIN
FOR rec IN (SELECT owner,
table_name
FROM all_tables WHERE owner = 'OWNER') -- replace OWNER with target schema
LOOP
EXECUTE IMMEDIATE 'begin
select count(*) into :n from '||
rec.owner||'.'||rec.table_name||';
end;'
USING OUT n;
dbms_output.put_line(rec.owner||'.'||rec.table_name||' - '||n);
END LOOP;
END;
/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment