Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to describe all tables in a schema

Status
Not open for further replies.

m2001331

Technical User
May 29, 2002
73
0
0
MY
Hi,
I would like to know if there are any methods to describe tables in a schema using one sql command, instead of doing desc 1,desc 2....desc n?
I would appreciate it if anyone could advise on this.I have a schema with over 200 tables and would really love to save sometime by avoiding to describe each and every table one by one.

thanks and regards.
 
SELECT TABLE_NAME, COLUMN_NAME FROM USER_TAB_COLUMNS

IF U WANT TO KNOW ABT THE CONSTRAINTS USE COMBINATION OF THE dictionary tables like user_tables, user_tab_columns, user_constraints, user_cons_columns
 
break on table_name

select table_name, column_name
, DECODE(nullable,'Y','','NOT NULL')
from user_tab_columns
order by table_name, column_id


Regards, Dima
 
Dima,

I would add the data type as well.

select table_name, column_name, data_type,
DECODE(nullable,'Y',' ','NOT NULL') as "Null?"
from user_tab_columns
order by table_name, column_id

Dan
 
Once upon a time I wrote a script combining user_tab_columns, user_tab_comments and user_col_comments and called it desc. Thus calling @desc <table> provided more complete table description. With todays GUI tools it worths about nothing :)

Regards, Dima
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top