List tables with size in Oracle
You may need this to list all the tables from an Oracle tablespace with the record or row count The list of tables comes from a SQL, but the rest must be done with PL/SQL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE | |
val NUMBER; | |
BEGIN | |
FOR I IN (select table_name from all_tables where owner = 'TABLESPACE') | |
LOOP | |
EXECUTE IMMEDIATE 'SELECT count(*) FROM TABLESPACE.' || i.table_name INTO val; | |
DBMS_OUTPUT.PUT_LINE(i.table_name || ' ==> ' || val ); | |
END LOOP; | |
END; |