Eine weitere WordPress-Website

How many records in a table?

Recently, I encountered a very nice script that allows us to get an overview of the number of records per table in an Oracle scheme. First the script:

set termout off echo off feed off trimspool
on head off pages 0
spool C:\countall.tmp
select 'SELECT count(*), '''||table_name||'''
from '||table_name||';'
from user_tables
/
spool off
set termout on
@@c:\countall.tmp
set head on feed on

The output then looks like:

As you can see, I stored the script in a file c:\a.sql, where I copied the script. The resulting output showed itself in the terminal.