show all tables for a user.sql
—
— tab_desc_usr.sql
— all tables for a user
— mdw date? way back in the mists of time
— my own replacement for desc.
— 16/11/01 improved the data_type section
 SET PAUSE ON
 –SET PAUSE ‘Any Key…>’
 set pause off
 SET PAGES 64
 col Tab_own form A10
 col tab_name form a22 wrap
 col col_name form a28 wrap
 col col_def form A14
 break on tab_own skip 1 on tab_name skip 1
 spool tab_desc_usr.lst
 select
— owner                              Tab_Own
 table_name            Tab_Name
,column_name           Col_Name
,decode(NULLABLE,’Y’,’N’,’Y’)Â Â Â Â Â Â Â Mand
,data_type||decode(data_type
      ,’NUMBER’,'(‘
       ||decode(to_char(data_precision)
               ,null,’38’
               ,    to_char(data_precision)||
                     decode(data_scale,null,”
                                     ,     ‘,’||data_scale)
                )
                   ||’)’
      ,’DATE’,null
      ,’LONG’,null
      ,’LONG RAW’,null
      ,'(‘||Substr(DATA_LENGTH,1,5)||’)’
        ) col_def
from dba_tab_columns
where owner like upper (nvl(‘&user_name’,’WHOOPS’)||’%’)
and table_name like upper (‘&TAB_NAME’||’%’)
order by 1,column_id,3,4
/
spool off
clear col
—
Discussion ¬