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: Describe all tables

Re: Describe all tables

From: Michel Cadot <micadot_at_netcourrier.com>
Date: Wed, 25 Aug 1999 17:20:52 +0200
Message-ID: <7q11ls$25s$1@oceanite.cybercable.fr>


Here's a script to run with SQL*Plus that gives all the tables of the current schema with theirs columns and the type of each one plus 'NOT NULL' if the column cannot be null.

Hope this is what you wish.

Set echo OFF
Set feedback OFF
Set heading OFF
Set linesize 2000
Set long 32760
Set newpage 0
Set pagesize 0
Set recsep OFF
Set space 0
Set trimout ON
Set trimspool ON
BTitle OFF
TTitle OFF

Spool desc

Select decode(col.column_id, 1, '

'||col.table_name||'
', '')||
'   '||col.column_name||' '||col.data_type||
    decode(col.data_type,

'NUMBER', decode(col.data_precision,
NULL, decode(col.data_scale, NULL, '', '(38)'), '('||col.data_precision|| decode(col.data_scale, NULL, ')', ','||col.data_scale||')')),
'CHAR', '('||col.data_length||')',
'VARCHAR2', '('||col.data_length||')',
'RAW', '('||col.data_length||')'
)||

    decode(col.nullable, 'N', ' NOT NULL', '') from user_tab_columns col
order by col.table_name, col.column_id
/

Spool off

HSK a écrit dans le message <7q0ues$20p$1_at_news.inet.tele.dk>...

>Hi..
>
>Does anyone have, or know how to make, a SQL-script that describes all
>tables a user owns (Oracle 7.3) ?
>
>regards,
>HSK
>
>


Received on Wed Aug 25 1999 - 10:20:52 CDT

Original text of this message

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