Avatar of Kamal Agnihotri
Kamal Agnihotri
Flag for United States of America asked on

Modify output of a query

-- 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.
Oracle Database

Avatar of undefined
Last Comment
Kamal Agnihotri

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
slightwv (䄆 Netminder)

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Kamal Agnihotri

ASKER
Slightwv,

Thanks. That worked.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy