Skip to Main Content

Referenced primary keys

OwnerTable NameColumn NameConstraint NameDelete RuleStatusR OwnerR Table NameR Column Name
TEDSTRUIKEMPDEPTNOSYS_C0013831NO ACTIONENABLEDTEDSTRUIKDEPTDEPTNO
TEDSTRUIKEMPMGRSYS_C0013830NO ACTIONENABLEDTEDSTRUIKEMPEMPNO

Hierarchy of primary & foreign keys

OwnerTable NameConstraint TypeConstraint NamePositionColumn NameR OwnerR Table NameR Column Name
TEDSTRUIKDEPTPSYS_C00138081DEPTNO
TEDSTRUIKEC_FILE_PATHSPEC_FPH_PK1FILE_PATH
TEDSTRUIKEC_SCORESPEC_SCE_PK1FILE_PATH
TEDSTRUIKEC_SCORESREC_SCE_FPH_FK1FILE_PATHTEDSTRUIKEC_FILE_PATHSFILE_PATH
TEDSTRUIKEMPPSYS_C00138001EMPNO
  • 1 - 5 of 35

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
Location
Query Type
Region Source

Region

Identification
Sequence
Title
Type
Source
Location
Query Type
Region Source