The number of rows in oracle tables

simodsio Posted messages 68 Status Member -  
 fiu -
Hello everyone

I would like to create a query or a small script that will allow me to output a table containing the tables of a given schema along with the number of rows in each

example :
---------------------------------
Table_name | Number_of_rows |
------------- -------------------
Table1 | 12235
--------------------------------

Thank you in advance for your help
Configuration: Windows XP Firefox 3.5.5

1 answer

  1. fiu
     
    Hi,

    in USR_TABLES (or DBA_ALL_TABLES), the row count is automatically populated for all tables for which you calculate (or - to be verified - estimate) the stats.
    otherwise, you can iterate through USR_TABLES and run a select count(1) for each table using the EXECUTE IMMEDIATE statement.
    0