Reputation: 159
Is there a Oracle data dictionary table/view that store the table referential integrity information? I thought the all_tab_column would show which column is the Pk/Fk.
Upvotes: 0
Views: 161
Reputation: 191235
The documentation has a section on Viewing Constraint Information:
Oracle Database provides the following views that enable you to see constraint definitions on tables and to identify columns that are specified in constraints:
DBA_CONSTRAINTS/ALL_CONSTRAINTS/USER_CONSTRAINTS
- DBA view describes all constraint definitions in the database. ALL view describes constraint definitions accessible to current user. USER view describes constraint definitions owned by the current user.
DBA_CONS_COLUMNS/ALL_CONS_COLUMNS/USER_CONS_COLUMNS
- DBA view describes all columns in the database that are specified in constraints. ALL view describes only those columns accessible to current user that are specified in constraints. USER view describes only those columns owned by the current user that are specified in constraints.
You can get more information on those in other sections of the documentation; ALL_CONSTRAINTS
and ALL_CONS_COLUMNS
.
You haven't said exactly what you're looking for, but this old answer has an example of looking at primary/unique and foreign keys.
Since you tagged your question with SQL Developer, if you view the table from the expanded Connections pane there is a Constraints tab that lists all the constraints on that table. If you select a constraint from the list you can see the columns it applies to. You can use the data modeller to see how tables are related.
Upvotes: 1