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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find Table Structure

Status
Not open for further replies.

CptTom

Programmer
Jul 16, 2001
117
US
I can't remember the select command that will list all tables and their structure (fields). When I pull them into text with headers on, some of the field names concantenate.

Thanks

Larry
 
Hi !!!

Try this select,

SELECT substr(a.COLUMN_ID, 1, 3),
substr(a.TABLE_NAME, 1, 30),
substr(a.COLUMN_NAME, 1, 30),
substr(a.DATA_TYPE, 1, 10), LPAD(DECODE(a.DATA_PRECISION,'',TO_CHAR(a.DATA_LENGTH), TO_CHAR(a.DATA_PRECISION)||'.'||TO_CHAR(a.DATA_SCALE)), 6),
LPAD(a.NULLABLE,3)
FROM user_tab_columns a,
user_catalog b
WHERE a.table_name = b.table_name
AND b.table_type = 'TABLE'
ORDER BY a.TABLE_NAME, a.COLUMN_ID;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top