set linesize 130;
set pagesize 10000;
set long 50;
set echo on;

/* ************************************************ */
/*                                                  */
/* script to perform the select count(*) from all   */
/*   tables under all schemas                       */
/*                                                  */
/*         @c:\oracle\sql\bld_slct.sql              */ 
/*                                                  */
/* ************************************************ */

set echo off;

select 'SELECT '''||rpad(table_name,25,' ')||''',COUNT(*) FROM '||owner||'.'||table_name||';'
from all_tables
where owner = upper('&&schema')
ORDER BY owner, table_name;

spool cnt_all.sql
/
spool off;

spool cnt_all.rslt
@cnt_all.sql
/
spool off;
undefine schema;
commit;
