Count rows in Maximo schema tables

Technical 0 Comments

Problem

------------------

How do I get count of all tables in Maximo with on single query?

 

Solution

-----------------

Just three steps, thats all .. 

--; Create function
create or replace
function        count_rows(OBJECTNAME varchar2) 
return varchar2 is
i number;
r sys_refcursor;
begin
open r for 'select count(*) c from MAXIMO.'||OBJECTNAME;
fetch r into i;
return i;
EXCEPTION 
 WHEN OTHERS THEN
  return -1 ;
End;

--; SQL query
select db.owner, db.table_name, count_rows(db.table_name) ROW_COUNT
from  all_tables db
where db.owner = 'MAXIMO' 
order by db.owner, db.table_name;

--; Drop function
drop function count_rows;
 

Share this post


Blog Comments


Post your comment






Thank You! You comment is under review and will be published soon..
Thank You! You comment is Published.