Chave estrangeira na tabela Oracle
SELECT c.OWNER, a.TABLE_NAME, a.COLUMN_NAME, a.CONSTRAINT_NAME,
c.R_OWNER AS REF_OWNER, cpk.TABLE_NAME AS REF_TABLE,
cpk.CONSTRAINT_NAME AS REF_PK
FROM ALL_CONS_COLUMNS a
JOIN ALL_CONSTRAINTS c ON a.OWNER = c.OWNER
AND a.CONSTRAINT_NAME = c.CONSTRAINT_NAME
JOIN ALL_CONSTRAINTS cpk ON c.R_OWNER = cpk.OWNER
AND c.R_CONSTRAINT_NAME = cpk.CONSTRAINT_NAME
WHERE c.CONSTRAINT_TYPE = 'R' AND c.TABLE_NAME= 'table_name';
VasteMonde