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;
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;
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;
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;
/
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 questionAll,Anyone know how to get a list of tablenames and the count of rows in themTABLE_NAME COUNT=========== ======LEE 10LEE1 25LEE2 17................etc etcI 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.Tru648.0.5.0.0TIALee
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.
