How to resolve "ORA-02290: check constraint (constraint_name) violated" in a merge statement?
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