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为外键名称)