|
Re: List the Desc of all database tables in the Schema [message #371814 is a reply to message #371811] |
Sat, 09 December 2000 22:22 |
SQL_Tuner
Messages: 8 Registered: November 2000
|
Junior Member |
|
|
Here it is:
break on table_name;
select Table_name, column_name, data_type, data_length
from all_tab_columns
where owner = '<schema_name>'
order by 1, column_sequence;
I don't have Oracle at this terminal, so double check the names of the columns for the dictionary
table ALL_TAB_COLUMNS. I might not have the names quite right. In particular, one of the columns has the sequence number that shows the right order of the columns in the table.
You can get these names with:
DESC ALL_TAB_COLUMNS;
Good luck!
Regards,
ST
|
|
|
Updated: List the Desc of all database tables in the Schema [message #371831 is a reply to message #371811] |
Tue, 12 December 2000 09:23 |
Shanthi Ramayanapu
Messages: 22 Registered: October 2000
|
Junior Member |
|
|
SQL Tuner answer will only fetch you the column name, datatype with precision. If you also want to see the nullable option which is visible thru desc command, include nullable in his query
OR
try the following at sql prompt
set heading off
spool filename.sql
select 'desc '||table_name from user_tables;
spool off
edit filename and delete the last line (Should only have the desc commands with tablesname)
@filename
when you run the above you get what you need.
Shanthi
|
|
|
Re: Updated: List the Desc of all database tables in the Schema [message #371838 is a reply to message #371811] |
Tue, 12 December 2000 13:41 |
SQL_Tuner
Messages: 8 Registered: November 2000
|
Junior Member |
|
|
Yes, add the nuallable column if you need it. There are some other items there you can explore.
Using 'desc' is an inferior method. Each time you use it, you have to recreate the script. Also, it is only for user_tables as described above. You would need to modify it for tables in other schemas. Using ALL_TAB_COLUMNS is more flexible, and can be completely parameter driven.
Regards,
ST
|
|
|