Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SQL query to find top 5 users having more rows/data in table

VIKHARAHMEDAug 8 2012 — edited Aug 8 2012
Dear experts,

OS = HP-UX
Database = Oracle 9.2.0.8
AC users = 600

Ex:-

select * from all_users where username like 'AC%';
AC_1
AC_2
AC_3
AC_4
AC_5
AC_6
AC_.
AC_.
AC_.
AC_600

Each AC user having same tables INCOMING, OUTGOING


Now i need to find top 5 users having more rows/data in INCOMING , OUTGOING tables. I tried this:

SQL>conn AC_1/pwd
select 'select count(*) from '||table_name||';' from user_tables;
But i get max counts info only for this AC_1 user , however, i need top 5 users having more rows/max counts query.

Thank you,
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 5 2012
Added on Aug 8 2012
8 comments
2,123 views