Foreign Key Violations
Missing corresponding rows in another table
- Similar to finding rows that fall through a join
- Master-detail deletion
Four commonly used methods:
- ROWID IS NULL with outer join
where b.xid(+) = a.xid and b.rowid is null
- Correlated subquery predicate to NOT EXISTS
where not exists
(select 'x' from b where b.xid = a.xid)
- Non-correlated subquery
where a.xid not in (select b.xid from b)
- MINUS with compound query
select a.xid from a
minus
select b.xid from b
TOC
Top
Next