Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: PL SQL <table_name> , count(*)

Re: PL SQL <table_name> , count(*)

From: DStevens <dstevens_at_navidec.com>
Date: Tue, 18 Dec 2001 10:08:56 -0700
Message-ID: <3C1F7828.EB5462E5@navidec.com>


Basically the same thing that others have proposed, does the count(*) rather than doing an analyze.

Declare
Column1 varchar2(50);
Column2 Integer;
sqltext varchar2(500);
c_handle Integer;
bogus Integer;
Cursor MyTables is
 select table_name
  from user_tables
  order by 1;
Begin
-- Construct the sql statement. Notice the use of double-single quotes to get

dbms_sql.parse(c_handle, sqltext, DBMS_SQL.NATIVE);
-- This binds the return columns. Is is required for select statements.
dbms_sql.define_column(c_handle, 1, Column1, 50); dbms_sql.define_column(c_handle, 2, Column2);
-- Actually execute the statement, required for select and dml statements
bogus := dbms_sql.execute(c_handle);
LOOP
 begin
-- The loop could be written differently.. this next statement fetches the next

Matt Gross wrote:

> I would like to create a pl/sql script which gives me a list of all tables
> and then gives me a count of all rows for each table.  Does anyone know how
> to do this?
>
> Thanks,
>
> Matt
Received on Tue Dec 18 2001 - 11:08:56 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US