Home » RDBMS Server » Server Administration » 'Noob'ish Type Question
'Noob'ish Type Question [message #57897] Wed, 16 July 2003 12:27 Go to next message
doofusboy
Messages: 1
Registered: July 2003
Junior Member
I know how to get a single table description using:

desc my_table_name

But I need to get the descriptions for 200+ tables with names ending in _SP and really don't want to have to type them out individually.

Any suggestions?
Re: 'Noob'ish Type Question [message #57900 is a reply to message #57897] Wed, 16 July 2003 17:58 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10707
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
-- this would be the simplest way.
-- else you have to query the dictionaries for all columns associated with a table

-- create a simple sql file a.sql as shown
-- this query lists the tables that start with name TEST
-- i have prompted to show the table name during the execution
-- chr(10) produces a new line
-- simlarly you can do any formatting you want
-- now do a spool to some kinda temp file
-- execute the sql
-- spool off
-- execute the spooled temp file

dbadmin@mutation_mutation > get a
  1  set head off
  2* select 'prompt description of table : '||table_name||chr(10)||'desc '||table_name ||';' from user_tables where table_name like ('TEST%')
dbadmin@mutation_mutation > spool dumm
dbadmin@mutation_mutation > @a

prompt description of table : TEST
desc TEST;

prompt description of table : TEST11
desc TEST11;

prompt description of table : TEST23
desc TEST23;

dbadmin@mutation_mutation > spool off
dbadmin@mutation_mutation > @dumm.lst
SP2-0734: unknown command beginning "dbadmin@mu..." - rest of line ignored.
description of table : TEST
 Name                                                  Null?    Type
 ----------------------------------------------------- -------- ------------------------------------
 ID                                                    NOT NULL NUMBER
 NAME                                                           VARCHAR2(10)

description of table : TEST11
 Name                                                  Null?    Type
 ----------------------------------------------------- -------- ------------------------------------
 ID                                                             VARCHAR2(30)

description of table : TEST23
 Name                                                  Null?    Type
 ----------------------------------------------------- -------- ------------------------------------
 Y                                                              VARCHAR2(300)

SP2-0734: unknown command beginning "dbadmin@mu..." - rest of line ignored.
dbadmin@mutation_mutation >

Re: 'Noob'ish Type Question [message #57906 is a reply to message #57900] Thu, 17 July 2003 14:38 Go to previous message
sidd
Messages: 130
Registered: May 2003
Senior Member
if u desc this view u can do it
SQL> desc user_tab_columns
Name Null? Type
----------------------------------------- -------- ----------------------------
TABLE_NAME NOT NULL VARCHAR2(30)
COLUMN_NAME NOT NULL VARCHAR2(30)
DATA_TYPE VARCHAR2(106)
DATA_TYPE_MOD VARCHAR2(3)
DATA_TYPE_OWNER VARCHAR2(30)
DATA_LENGTH NOT NULL NUMBER
DATA_PRECISION NUMBER
DATA_SCALE NUMBER
NULLABLE VARCHAR2(1)
COLUMN_ID NOT NULL NUMBER
DEFAULT_LENGTH NUMBER
DATA_DEFAULT LONG
NUM_DISTINCT NUMBER
LOW_VALUE RAW(32)
HIGH_VALUE RAW(32)
DENSITY NUMBER
NUM_NULLS NUMBER
NUM_BUCKETS NUMBER
LAST_ANALYZED DATE
SAMPLE_SIZE NUMBER
CHARACTER_SET_NAME VARCHAR2(44)
CHAR_COL_DECL_LENGTH NUMBER
GLOBAL_STATS VARCHAR2(3)
USER_STATS VARCHAR2(3)
AVG_COL_LEN NUMBER

then write a cursor to and spool it or whatever u wanna do
Previous Topic: SHUTDOWN & STARTUP trigger in 8.1.7
Next Topic: autoextend on/db
Goto Forum:
  


Current Time: Fri Sep 20 11:50:45 CDT 2024