PL/SQL (MOSC)

MOSC Banner

How to do a SELECT with a composite key?

edited Sep 18, 2019 12:10PM in PL/SQL (MOSC) 4 commentsAnswered ✓

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);

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center