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

Data Dictionary Table/View of Constraints? 1

Status
Not open for further replies.

tonedef

Programmer
May 24, 1999
64
US
Is there a Data Dictionary Table or View where I can get constraint definitions.&nbsp;&nbsp;What I am looking for is a way to find all constraint names, types (Primary, Unique, Foriegn, Check) and also if it is foriegn what are the referenced schema.table and if it is check what is the check.&nbsp;&nbsp;<br><br>Also on a related note, Is there a good reference available of the Data Dictionary tables/view.&nbsp;&nbsp;The Oracle Press books that I have (Oracle 8 PL/SQL Programming and Oracle 8i DBA Handbook) both touch on them but neither gets into too much detail.<br><br>TIA,<br><br>tone
 
You are looking for the DBA_CONSTRAINTS and DBA_CONS_COLUMNS views.&nbsp;&nbsp;DBA_CONSTRAINTS will give you the basic information you listed.&nbsp;&nbsp;DBA_CONS_COLUMNS will give you information such as which column(s) the constraint is defined on.<br><br>I find the Server Administrator's Guide and Server Reference Manuals that come with the server to be the best sources of information like this.
 
carp,<br><br>I found those to views but they still don't tell me the referenced columns in a foreign key or the value of the check constraint.&nbsp;&nbsp;I also found a view called DICTIONARY while I was searching.&nbsp;&nbsp;This view gives that name of the views in the data dictionary with a description.&nbsp;&nbsp;Then there is DICT_COLUMNS which gives descriptions of all the columns in all the data dictionary views in DICTIONARY. <br><br>tone
 
Sure they do!&nbsp;&nbsp;In DBA_CONSTRAINTS, the r_constraint_name tells you which Primary Key or Unique constraint your FK constraint references.&nbsp;&nbsp;Likewise, search_condition will tell you what your check constraint is checking.
 
carp,<br><br>THANK YOU!&nbsp;&nbsp;That was what I needed.&nbsp;&nbsp;I couldn't see what r_constraint_name was all about until your last post.&nbsp;&nbsp;<br><br>tone
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top