How to do a SELECT with a composite key?
I received the following error while trying to enable constraint OBL_TXN_PROJECT_PHASE_FK:
ALTER TABLE PRODUCTION.OBLIGATION_TRANSACTION
MODIFY CONSTRAINT OBL_TXN_PROJECT_PHASE_FK
ENABLE
Error at line 2
ORA-02298: cannot validate (PRODUCTION.OBL_TXN_PROJECT_PHASE_FK) - parent keys not found
The FOREIGN KEY of CONSTRAINT OBL_TXN_PROJECT_PHASE_FK is (PROJECT_ID, PHASE_NUMBER)
which REFERENCES Parent table PROJECT_PHASE (PROJECT_ID,PHASE_NUMBER)
I am trying to locate "orphan rows" with SQL similar to the following:
select child_key from from child_table
where
child_key not in (select parent_key from parent_table);