troubleshooting Question

Modify output of a query

Avatar of Kamal Agnihotri
Kamal AgnihotriFlag for United States of America asked on
Oracle Database
2 Comments1 Solution39 ViewsLast Modified:
-- The code below works.

declare
     v_row  integer := 0;
     v_rowcnt integer;
 begin
     for t in (select table_name from user_tables order by 1) loop
         v_row := v_row + 1;
         execute immediate 'select count(*) from ' || t.table_name into v_rowcnt;
         dbms_output.put_line (rpad(v_row, 5, ' ') || (rpad(t.table_name,40,'.') || v_rowcnt));
     end loop;    
 end;    
/
--#############################################################

I want to add the corresponding Tablespace_Name to the output for it to look like

1    ACCOUNT................................23..............Adv_Data                
2    AD......................................       50..............Adv_Data          
3    AD_AGE_STATED...................70.............Adv_Data
4    AD_BODY.................................60............ Bev_Data
5    AD_CATEGORY......................45..............Adv_Data          
6    AD_LOCATION_STATED.......25..............Bev_Data

What change to make in the code on top.
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros