select a.constraint_name as fk,
a.table_name as tname,
b.constraint_name as pk
from user_constraints a, user_constraints b
where a.constraint_type = 'R'
and b.constraint_type = 'P'
and a.r_constraint_name = b.constraint_namesql
這裏記得用as一下別名,否則外層嵌套select查詢語句,會報列未定義。table
完整的以下:select
select t.*
from (select a.constraint_name as fk,
a.table_name as tname,
b.constraint_name as pk
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) t
where t.tname = 'T_PUB_OPTION'im
2、知道表名了,能夠新建一個圖表窗口(英文版的pl/sql是Diagram Window),而後把有關係的表拖到該視圖中。以下:圖表