REM *******************************************************************
REM David L. Hunt (file author) distributes this and other
REM files/scripts for educational purposes only, to illustrate the
REM use or application of various computing techniques. The author
REM makes no warranty regarding this script's fitness for any
REM industrial application or purpose nor is there any claim that
REM this or any similarly-distributed scripts are error free or
REM should be used for any purpose other than illustration.
REM *******************************************************************
set echo off
set verify off
set feedback off
set linesize 100
set pagesize 500
accept x prompt "Enter table name: "
col a format a18 heading "Column|Name" word_wrapped
col b format a13 heading "Data Type|and Length"
col "#" format 99 heading "Col| # "
select column_id "#",
col.column_name a,
col.data_type ||
decode(substr(data_type,1,4),
'DATE',null,
'LONG',null,
'CLOB',null,
'BLOB',null,
'VARC','('||ltrim(to_char(data_length,'9999'))||')',
'CHAR','('||ltrim(to_char(data_length,'999'))||')',
'FLOA','('||ltrim(to_char(data_precision,'99'))||
decode(data_scale,
0,null,
','||ltrim(to_char(data_scale,'9999')))||')'
,null,
'NUMB','('||ltrim(to_char(data_precision,'99'))||
decode(data_scale,
0,null,
','||ltrim(to_char(data_scale,'999')))||')'
,null)
b
from user_tab_columns col
where col.table_name = upper('&x')
order by 1
/