📜  外键 oracle - SQL 代码示例

📅  最后修改于: 2022-03-11 15:04:54.800000             🧑  作者: Mango

代码示例3
SELECT cons.OWNER             AS CHILD_OWNER,
       cons.TABLE_NAME         AS CHILD_TABLE,
       cons.CONSTRAINT_NAME AS CONSTAINT_NAME,
       cons.CONSTRAINT_TYPE AS CONSTRAINT_TYPE,
       col.OWNER             AS PARENT_OWNER,
       col.TABLE_NAME         AS PARENT_TABLE,
       col.COLUMN_NAME         AS COLUMN_NAME
FROM DBA_CONS_COLUMNS col, DBA_CONSTRAINTS cons
WHERE cons.R_OWNER = col.OWNER
  AND cons.R_CONSTRAINT_NAME = col.CONSTRAINT_NAME
  AND cons.TABLE_NAME = 'table_name';