Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: Quick select question
> Robertson Lee - lerobe wrote:
>
> 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
>
>
Brute force :
set echo off
set pagesize 0
set pause off
set feedback off
set recsep off
spool brute_force.sql
select 'select rpad(''' || table_name || ''',30) || to_char(count(*),
''99999999999990'')'
|| chr(10) || 'from ' || table_name || ';'
from user_tables
order by table_name;
spool off
select rpad('TABLE', 30) || 'ROW COUNT' || chr(10)
|| '---------------------------------------------------'from dual;
-- Regards, Stephane Faroult Oriole Corporation Voice: +44 (0) 7050-696-269 Fax: +44 (0) 7050-696-449 Performance Tools & Free Scripts -------------------------------------------------------------- http://www.oriole.com, designed by Oracle DBAs for Oracle DBAs -------------------------------------------------------------- -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Stephane Faroult INET: sfaroult_at_oriole.com 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: ListGuru_at_fatcity.com (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).Received on Wed Jun 20 2001 - 14:37:06 CDT
![]() |
![]() |