Wednesday, 24 December 2014

Query to get count of all tables in a Oracle Database for Specific User

Query :

select table_name
     , to_number
       ( extractvalue
        ( dbms_xmlgen.getxmltype('select count(*) c from ' || table_name)
         , '/ROWSET/ROW/C'
         )
      ) cnt
 from user_tables
order by table_name

Example :
If you have logged in as user 'A' then the above query will display all the tables and count information available for User 'A'.


No comments:

Post a Comment