RE: Select Select

From: <mcglew_at_jolt.att.com>
Date: 1997/09/24
Message-ID: <875115960.16420_at_dejanews.com>#1/1


In response to
"I want to get a list of all tables and the number of records in those tables for just the tables that have records in them."

drop table this_temp_table;
create table this_temp_table (
num integer,
table_name varchar2(30));

set heading off
set pagesize 0
set linesize 150
set feedback off
set termout off
spool temp_table_1.sql
select 'select ''insert into this_temp_table (num,table_name) values ('',' x,
' count(*),'','''''||table_name||''''');'' from '||table_name||';' from user_tables;
spool off
spool temp_table_2.sql
start temp_table_1.sql
spool off
spool insert_them_temp.lst
start temp_table_2.sql
spool off
start insert_them_temp.lst
set termout on
spool count_them.lst
select * from this_temp_table where num >0 order by num desc
/
drop table this_temp_table;
spool off

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet
Received on Wed Sep 24 1997 - 00:00:00 CEST

Original text of this message