Home » SQL & PL/SQL » SQL & PL/SQL » count(*)
count(*) [message #2518] Tue, 23 July 2002 01:14 Go to next message
Deepa
Messages: 269
Registered: November 2000
Senior Member
hi,
I want to select count(*) from each table which is accessed by a particular user.without using dynamic sql i want to write a sql statement with sub-query.

thanks and regards,
S.Deepalakshmi
Re: count(*) [message #2521 is a reply to message #2518] Tue, 23 July 2002 06:28 Go to previous messageGo to next message
Saga
Messages: 51
Registered: April 2002
Member

Well Deepa u can use the all_tables view or user_tables view for your purpose.
Describe all_tables and user_tables view and in both the views u will find num_rows column which gives the count for each tables.
But before that u need to analyze the schema to populate the column.

Hope it will help
Re: count(*) [message #2524 is a reply to message #2518] Tue, 23 July 2002 09:27 Go to previous message
Mahesh Rajendran
Messages: 10707
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
else
you can use a generic sql like this,

spool c:generatesql.sql;
select 'select count(*) from '|| table_name ||';'|| from all_tables where owner='myUser';
spool off;

now the spool file generatesql.sql will contain something like ( format the unwanted results like headins in spool file).
select count(*) from table1;
select count(*) from table2;
....

when u run this sql, u may get what u want.

@generatesql.sql
Previous Topic: Cursor in PL/SQL not sorted based on input parameter
Next Topic: invalid feild definiton error
Goto Forum:
  


Current Time: Wed Apr 24 00:13:54 CDT 2024