Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: arguments
On Thu, 19 Mar 1998 10:50:24 GMT, a.habraken_at_delion.com (Arthur Habraken) wrote: Hi,
one way would be:
set head off pages 0 feed off
spool t.sql
select 'Select Count(*) Counts,' || tablename || ' table from' || owner || '.' ||table_name|| ' ;'
from all_tables
where
owner= <YOUR_SCHEMA>
/
spool off
spool analyze.log
set termout on
set echo on
@t.sql;
spool off
Another to anlayze the tables and then inspect column 'NUW_ROWS' in table all_tables.
set head off pages 0 feed off
spool t.sql
select 'analyze table' || owner '.' ||table_name||' COMPUTE statistics;'
from all_tables
where
owner='YOU'
/
spool off
spool analyze.log
set termout on
set echo on
@t.sql;
spool off
>I want something very simple. For testing purposes I need to count the
>number of records in a lot of tables. I'd like to make a procedure
>count_records like this :
>
>declare
> procedure count_records(thetable IN char) is
> max number;
> begin
> select count(*) into max from thetable;
> dbms_output.put_line('# records in ' || thetable || ' :' || max);
> end count_records;
>
>begin
> count_records('table1');
> count_records('table2');
> count_records('table3);
>.
>.
>.
>.
> count_records('table101');
> count_records('table102');
> count_records('table103');
>end;
>
>This doesn't work. Is there another solution to do something like this
>?
>
>Thanks in advance,
>
>Arthur Habraken,
>The Netherlands
-- Regards Matthias Gresz :-) GreMa_at_T-online.deReceived on Thu Mar 19 1998 - 00:00:00 CST