Oracle根據主鍵獲取對應表spa
select * from user_constraints a, USER_CONS_COLUMNS b where a.CONSTRAINT_TYPE = 'P' and a. constraint_name = b.constraint_name and a.constraint_name = 'PK151'; --根據主鍵名查詢表(PK151爲主鍵名稱)
Oracle根據外鍵獲取相關表code
select * from user_constraints cc where cc.r_constraint_name in (select c.r_constraint_name from user_constraints c where c.constraint_type = 'R' and c.constraint_name = 'REFB_BJB125') --根據外鍵獲取相關的表(REFB_BJB125爲外鍵名稱)