PL/SQL (MOSC)

MOSC Banner

How to resolve "ORA-02290: check constraint (constraint_name) violated" in a merge statement?

edited Apr 24, 2019 3:05PM in PL/SQL (MOSC) 6 commentsAnswered ✓

Hello Y'all,

I received "ORA-02290: check constraint (PRODUCTION.PROJ_PH_PHASE_NUMBER_CK) violated" after running the following merge statement:

{code }

merge into project_phase target

  using (select distinct project_id, phase_cd from staging_iris

             where project_id is not null) source

  on (target.project_id = source.project_id and target.phase_number = source.phase_cd)

  when not matched then

  insert (target.project_id, target.phase_number)

  values (source.project_id, source.phase_cd)

/

{code }

The following code is excerpted from the script for table project_phase:

{code }

ALTER TABLE PROJECT_PHASE ADD (

  CONSTRAINT PROJ_PH_PHASE_NUMBER_CK

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