Oracle查看表之间的键关联关系

/ Oracle / 没有评论 / 269浏览
SELECT
	A .CONSTRAINT_NAME ,
	A .TABLE_NAME ,
	B.CONSTRAINT_NAME 
FROM
	USER_CONSTRAINTS A,
	USER_CONSTRAINTS B
WHERE
	A .CONSTRAINT_TYPE = 'R'
AND B.CONSTRAINT_TYPE = 'P'
AND A .R_CONSTRAINT_NAME = B.CONSTRAINT_NAME
AND A .CONSTRAINT_NAME = 'FK_T_ACCT_C_REFERENCE_T_LOAN'

P 代表主键 R 代表外键

参考地址:http://www.2cto.com/database/201304/204969.html