We help IT Professionals succeed at work.
Get Started

Modify output of a query

Kamal Agnihotri
on
36 Views
Last Modified: 2016-02-02
-- 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.
Comment
Watch Question
CERTIFIED EXPERT
Most Valuable Expert 2012
Distinguished Expert 2020
Commented:
This problem has been solved!
Unlock 1 Answer and 2 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE