PL/SQL for 2 looping structure

I want to get the name of the tables belonging to a user and then find the record count count(*) for that table in a 2nd loop and insert table_name, count(*) into a static table
Thanks
Greens8301Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
slightwv (䄆 Netminder)Connect With a Mentor Commented:
You can do in in a single sql statement.

Take the following solution, add the table_name, an insert into table (select ...), change the view from user_tables to dba_users and add a: where username in ('A','B');
And you should be good to go.

http://www.experts-exchange.com/Database/Oracle/Q_25111045.html?#a26476979
0
 
Greens8301Author Commented:

For ueach user in (usr1,usr2,usr3 ...)
loop 1
Get the names of tables belonging to the user
loo 2
get the total number of records for each table that user owns

INSERT into a static table (table_name, recCNT)

I need a PL/SQL code to do this

Thanks
0
 
slightwv (䄆 Netminder) Commented:
I remembered you need to remove the SUM call in that code.
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
iaakovCommented:
try


insert into tab_resume (tab_name ,tab_count)
select table_name ,num_rows
from dba_tables
where owner = 'NAME_USER'
0
 
slightwv (䄆 Netminder) Commented:
Num_rows is an estimate based off statistics.  You need to be aware the number might be off.
0
 
Greens8301Author Commented:
Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.