Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: SELECT Statement help required
Tim Witort wrote:
>
> Jon Winchester wrote:
> >
> > James Petts wrote:
> > >
> > > I'm trying to write a SELECT statement which will return the
> > > number of rows in each of a set of tables selected by owner
> > > from DBA_TABLES.
> > >
> >
> > I use this SQL to select the number of rows from USER_TABLES :
> >
> > column table_name format A16
> > column num_rows format 999,999,999 heading 'Rows' ;
> > column blocks format 999,999 heading 'Blocks' ;
> > column empty_blocks format 999,999 heading 'Empty Blocks' ;
> > compute sum of empty_blocks on report
> > compute sum of blocks on report
> > break on report
> >
> > select table_name, num_rows, blocks, empty_blocks, avg_row_len
> > from user_tables
> > order by table_name;
>
> That assumes that the NUM_ROWS column is being populated.
> None of the dozen or so Oracle instances I have encountered
> have had this column populated.
>
True. I should have added that you need to run analyze against the
tables prior to running this script. (A good thing to do occasionally
anyway.)
Received on Fri Jul 25 1997 - 00:00:00 CDT