Skip to Main Content

Referenced primary keys

OwnerTable NameColumn NameConstraint NameDelete RuleStatusR OwnerR Table NameR Column Name
TEDSTRUIKEMPDEPTNOSYS_C0013089NO ACTIONENABLEDTEDSTRUIKDEPTDEPTNO
TEDSTRUIKEMPMGRSYS_C0013088NO ACTIONENABLEDTEDSTRUIKEMPEMPNO

Hierarchy of primary & foreign keys

OwnerTable NameConstraint TypeConstraint NamePositionColumn NameR OwnerR Table NameR Column Name
TEDSTRUIKDEPTPSYS_C00130691DEPTNO
TEDSTRUIKEMPPSYS_C00130621EMPNO
TEDSTRUIKEMPRSYS_C00130881MGRTEDSTRUIKEMPEMPNO
TEDSTRUIKEMPRSYS_C00130891DEPTNOTEDSTRUIKDEPTDEPTNO
TEDSTRUIKLOGGER_LOGSPLOGGER_LOGS_PK1ID
  • 1 - 5 of 27

Info

Primary & foreign keys and the tables & columns they reference.

Referenced primary keys
Simple query that lists all primary keys and the tables & columns they use. Adjust the where clause to your needs.

Hierarchy of primary & foreign keys
A more complex query:
This will travel the hierarchy of foreign keys for a given table and column and return columns from child and grandchild, and all descendant tables.
It uses sub-queries to add r_table_name and r_column_name to user_constraints, and then uses them to connect rows.

Adjust the where clause to your needs.

To get this to work, either run these queries as sys/system, change the quries to use the user_% or all_% views instead of sys_% views, or give the user these 2 privileges:
You can find the original queries here; I did change them quite a bit to make them more legible and to use the dba_% views:
http://stackoverflow.com/questions/1729996/list-of-foreign-keys-and-the-tables-they-reference

Code

Region

Identification
Sequence
Title
Type
Source
Source Type
Region Source

Region

Identification
Sequence
Title
Type
Source
Source Type
Region Source