Link to home
Start Free TrialLog in
Avatar of M THIAM
M THIAM

asked on

Error ORA-00001 Violation de contrainte Unique

hi; i i have develop a tool with use database metadata to define order of integration between the different tables and build and execute sql merge query dynamically.
I got an issue 0RA- 00001

MERGE INTO HARPAGON.PTSUIV Cible USING
( SELECT DISTINCT Tempo.CODPARAM,
Tempo.LIBPTSUIV,
Tempo.TYPPTSUIV,
Tempo.LIBIHM,
Tempo.MODIF_USER,
Tempo.MODIF_DATE,
Tempo.UNITE,
Tempo.ORDVISU,
Tempo.TYPCONV,
FromMap2.LIB_RES_ID_NEW PTSUIV_LIB_RES_ID,
FromMap1.LIB_RES_ID_NEW IHM_LIB_RES_ID
FROM UTIPORTABLE.PTSUIV Tempo  
Inner Join UTIPORTABLE.LIB_RES_MAP FromMap1 ON (Tempo.IHM_LIB_RES_ID = FromMap1.LIB_RES_ID_OLD)
Inner Join UTIPORTABLE.LIB_RES_MAP FromMap2 ON (Tempo.PTSUIV_LIB_RES_ID = FromMap2.LIB_RES_ID_OLD))
Source
ON (Source.CODPARAM = Cible.CODPARAM AND Source.LIBIHM = Cible.LIBIHM)
WHEN NOT MATCHED THEN
INSERT (CODPARAM,LIBPTSUIV,TYPPTSUIV,LIBIHM,MODIF_USER,MODIF_DATE,UNITE,ORDVISU,TYPCONV,PTSUIV_LIB_RES_ID,IHM_LIB_RES_ID)
VALUES (Source.CODPARAM, Source.LIBPTSUIV, Source.TYPPTSUIV, Source.LIBIHM, Source.MODIF_USER, Source.MODIF_DATE,
Source.UNITE, Source.ORDVISU, Source.TYPCONV, Source.PTSUIV_LIB_RES_ID, Source.IHM_LIB_RES_ID)
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

What is the primary key for HARPAGON.PTSUIV?
Avatar of M THIAM

ASKER

CODPARAM IS THE PRIMARY KEY
Avatar of M THIAM

ASKER

IS IT POSSIBLE THE ISSUE COME FROM THE PARENT TABLE FROM WHICH COME THE VALUE OF THE TWO LAST FIELD ?
Avatar of M THIAM

ASKER

i have find the solution, i have to use only the CODPARAM field for the compare clause
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.