Skip to content

Instantly share code, notes, and snippets.

@ser1zw
Created June 22, 2012 20:42
Show Gist options
  • Save ser1zw/2975064 to your computer and use it in GitHub Desktop.
Save ser1zw/2975064 to your computer and use it in GitHub Desktop.
SQL for counting rows of all tables (tested on Oracle 10g)
-- SQL for counting rows of all tables (tested on Oracle 10g)
-- http://laurentschneider.com/wordpress/2007/04/how-do-i-store-the-counts-of-all-tables.html
SELECT
TABLE_NAME,
TO_NUMBER(
EXTRACTVALUE(
XMLTYPE(DBMS_XMLGEN.GETXML('SELECT COUNT(*) C FROM ' || TABLE_NAME)),
'/ROWSET/ROW/C'
)
) COUNT
FROM
USER_TABLES;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment