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!

Selecting table structure and constraints

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi
May I know whats the query to find out column names and constraints on them, for a given table name.
Complete query will bw highly appreciated
Thanks
 
For table columns:

SELECT column_name FROM dba_tab_columns WHERE table_name = 'MY_TABLE';

For constraints you will have to look at DBA_CONSTRAINTS and DBA_CONS_COLUMNS.

DBA_CONSTRAINTS will tell you the consraint name and what type of constraint it is.
DBA_CONS_COLUMNS will tell you the constraint name as well as which column(s) it applies to.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top