view_fk

create or replace view view_fk as
select
    a.table_name 外键表,
    c.column_name 外键列,
    b.table_name 主键表,
    d.column_name 主键列,
    decode(a.validated,'VALIDATED',0,1) 多选
from
    user_constraints a,
    user_constraints b,
    user_cons_columns c,
    user_cons_columns d
where
    a.r_constraint_name=b.constraint_name
    and a.constraint_type='R'
    and b.constraint_type='P'
    and a.r_owner=b.owner
    and a.constraint_name=c.constraint_name
    and b.constraint_name=d.constraint_name
    and a.owner=c.owner
    and a.table_name=c.table_name
    and b.owner=d.owner
    and b.table_name=d.table_name

 

 

你可能感兴趣的:(view)