1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
  | 
with con1 as
(select /*+rule*/
      c.owner, c.constraint_name, cc.table_name, cc.column_name, cc.position
        from dba_constraints c, dba_cons_columns cc
      where c.constraint_type = 'R'
          and c.owner = cc.owner
          and c.constraint_name = cc.constraint_name),
ind1 as
  (select /*+rule*/
      i.owner, i.table_name, i.index_name, ic.column_name, ic.column_position
        from dba_indexes i, dba_ind_columns ic
      where i.owner = ic.index_owner
          and i.index_name = ic.index_name)
select c1.owner,
              c1.constraint_name,
              c1.table_name,
              c1.column_name,
              c1.position,
              i1.owner,
              i1.table_name,
              i1.index_name,
              i1.column_name,
              i1.column_position
    from con1 c1, ind1 i1
  where c1.owner = i1.owner(+)
      and c1.table_name = i1.table_name(+)
      and c1.column_name = i1.column_name(+)
      and c1.position = i1.column_position(+)
and i1.column_name is null;
  |