Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Table documentation

Re: Table documentation

From: John Strange <jstrange_at_imtn.dsccc.com>
Date: 13 Aug 1998 17:25:53 GMT
Message-ID: <6qv7j1$1tg$1@relay1.dsccc.com>


Try this

/*****************************************************************
*
*       desc_tbl.sql - Describe user's tables with comments.
*
*	usage - sqlplus scott/tiger @desc_tbl.sql
*
*       output - desc_tbl.lis  (180 col)
*
*****************************************************************/

column data_type format a15
column column_name format a25
column comments format a70
column table_name format a23

set linesize 180
set pagesize 6000
set pause off
set term off

break on table_name skip 1 nodup

spool desc_tbl.lis

select tc.table_name

  , tc.column_name
  , tc.nullable
  , decode (rtrim (tc.data_type),

'CHAR', DATA_TYPE || '(' || DATA_LENGTH || ')',
'NUMBER', DATA_TYPE || '(' || DATA_PRECISION || '.' || DATA_SCALE || ')',
'DATE', DATA_TYPE,
'VARCHAR2', DATA_TYPE || '(' || DATA_LENGTH || ')',
'LONG', DATA_TYPE, data_type

    ) DATA_TYPE
  , cc.comments
 FROM user_tab_columns tc, user_col_comments cc WHERE cc.table_name = tc.table_name
  and cc.column_name = tc.column_name
order by tc.table_name, column_id
/
spool off
exit ;
/****************** end        desc_tbl.sql ********************************/



Corinna Becker (Corinna.Becker_at_memo.ikea.com) wrote:

: Hello,
: I want to write a documentation of all our tables by using the desc
: command.
: Is there a way to do something in SQLPLUS like "desc (all tables that we
: have)"?
: Thanks in advance
: Corinna Becker

--
While DSC may claim ownership of all my ideas (on or off the job), DSC does not claim any responsibility for them. Warranty expired when you opened this article and I will not be responsible for its contents or use. Received on Thu Aug 13 1998 - 12:25:53 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US