ORACLE查看某个表的主外键关系

in #oracle6 years ago

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'

Coin Marketplace

STEEM 0.26
TRX 0.21
JST 0.038
BTC 96505.82
ETH 3656.11
USDT 1.00
SBD 3.87