Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Count rows

Status
Not open for further replies.

ofsouto

Programmer
Apr 29, 2000
185
BR
How can I count rows of all tables on a instance?
Oracle 8i (release 8.1.7)
 
The following should produce a script you can run to get a count of all tables.

set pagesize 30000
spool xxxx
select 'select count(*) from '||table_name||';' from all_tables
 
There are two problems here - (1) no "spool off" and (2) what happens if there is no synonym for the table. Try the following:

set pagesize 0
spool table_row_count
select 'select 'select '||''''||table_name||''''||', count(*) from '||owner||'.'||table_name||';' from dba_tables;
spool off
@table_row_count.lst
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top