Skip to Main Content

Referenced primary keys

OwnerTable NameColumn NameConstraint NameR OwnerR Table Name
TEDSTRUIKEMPDEPTNOSYS_C0012382TEDSTRUIKDEPT
TEDSTRUIKEMPMGRSYS_C0012383TEDSTRUIKEMP

Hierarchy of primary & foreign keys

OwnerTable NameConstraint TypeConstraint NamePositionColumn NameR OwnerR Table Name
TEDSTRUIKDEPTPSYS_C00123651DEPTNO
TEDSTRUIKEMPPSYS_C00123591EMPNO
TEDSTRUIKEMPRSYS_C00123821DEPTNOTEDSTRUIKDEPT
TEDSTRUIKEMPRSYS_C00123831MGRTEDSTRUIKEMP
TEDSTRUIKLOGGER_LOGSPLOGGER_LOGS_PK1ID
  • 1 - 5 of 24

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.

Either run these as sys/system, 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