ORACLE查看某个表的主外键关系
SELECT USER_CONS_COLUMNS.CONSTRAINT_NAME AS 约束名,
USER_CONS_COLUMNS.TABLE_NAME AS 子表名,
USER_CONS_COLUMNS.COLUMN_NAME AS 子表列名,
USER_CONS_COLUMNS.POSITION AS 位置,
USER_INDEXES.TABLE_NAME AS 主表名,
USER_IND_COLUMNS.COLUMN_NAME AS 主表列名
FROM USER_CONSTRAINTS
JOIN USER_CONS_COLUMNS
ON (USER_CONSTRAINTS.CONSTRAINT_NAME =
USER_CONS_COLUMNS.CONSTRAINT_NAME)
JOIN USER_INDEXES
ON (USER_CONSTRAINTS.R_CONSTRAINT_NAME = USER_INDEXES.INDEX_NAME)
JOIN USER_IND_COLUMNS
ON (USER_INDEXES.INDEX_NAME = USER_IND_COLUMNS.INDEX_NAME)
WHERE CONSTRAINT_TYPE = 'R' and USER_INDEXES.TABLE_NAME = 'MAPPED_EVENT_TYPE'