赞
踩
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
这里记得用as一下别名,不然外层嵌套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'
二、知道表名了,可以新建一个图表窗口(英文版的pl/sql是Diagram Window),然后把有关系的表拖到该视图中。如下:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。