This is another way, although you don't get it in your required format:
select 'select count(1) '||table_name|| ' from ' || table_name ||';' from
user_tables;
HTH
Prakash
-----Original Message-----
Sent: Wednesday, June 20, 2001 1:50 PM
To: Multiple recipients of list ORACLE-L
Hi Lee,
Here's how you can do it in PL/SQL. It can easily be converted to SQL if
realy realy want it :).
set serveroutput on size 1000000
declare
cursor c is select table_name from user_tables;
rec c%rowtype;
begin
open c;
fetch c into rec;
dbms_output.put_line('select ');
dbms_output.put_line( 'select '||''''||rec.table_name||''''||' table_name'
||',count(*) from '||rec.table_name
);
fetch c into rec;
while c%found
loop
dbms_output.put_line( 'union all '||chr(10)
||'select '||''''||rec.table_name||''''
||',count(*) from '||rec.table_name
);
fetch c into rec;
end loop;
dbms_output.put_line(';');
end;
/
HTH, Remco
-----Oorspronkelijk bericht-----
Van: Robertson Lee - lerobe [mailto:[EMAIL PROTECTED]]
Verzonden: woensdag 20 juni 2001 19:17
Aan: Multiple recipients of list ORACLE-L
Onderwerp: Quick select question
All,
Anyone know how to get a list of tablenames and the count of rows in them
TABLE_NAME COUNT
=========== ======
LEE 10
LEE1 25
LEE2 17................etc etc
I know it can be done if the tables are analyzed and from user_tables but
was wanting to know how to do it from sqlplus.
Tru64
8.0.5.0.0
TIA
Lee
The information contained in this communication is
confidential, is intended only for the use of the recipient
named above, and may be legally privileged. If the reader
of this message is not the intended recipient, you are
hereby notified that any dissemination, distribution or
copying of this communication is strictly prohibited.
If you have received this communication in error, please
re-send this communication to the sender and delete the
original message or any copy of it from your computer
system.
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Bala, Prakash
INET: [EMAIL PROTECTED]
Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
San Diego, California -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing).