hi,
I am migrating data and have the problem that the host has no ref integrity. Resulting in my script failing with
ORA-00001: unique constraint (OMCOD.PK_OSMORUL) violated. Does anyone know how I can ignore the failed inserts and continue?
declare
cursor ORRCD IS
SELECT ORORDREF, ORRULCD, ORSTAT, ORTEXT FROM OSMXDE061.OSMORUL@OSMOSYS.DB2
WHERE ORRULCD IN ((select rlcode from OSMXDE061.OSMRUL@OSMOSYS.DB2))
order by orordref, orrulcd ;
tORORDREF number(10);
tORRULCD number(10);
tORSTAT varCHAR2(15);
tORTEXT varCHAR2(50);
tCountOSMORUL Integer;
BEGIN
OPEN ORRCD;
LOOP
FETCH ORRCD INTO tORORDREF , tORRULCD, tORSTAT, tORTEXT;
INSERT INTO OSMORUL (ORORDREF, ORRULCD, ORSTAT, ORTEXT) VALUES (tORORDREF , tORRULCD, tORSTAT, tORTEXT);
EXIT WHEN ORRCD%NOTFOUND;
End loop read_OrRCD;
end;
/
WP
I am migrating data and have the problem that the host has no ref integrity. Resulting in my script failing with
ORA-00001: unique constraint (OMCOD.PK_OSMORUL) violated. Does anyone know how I can ignore the failed inserts and continue?
declare
cursor ORRCD IS
SELECT ORORDREF, ORRULCD, ORSTAT, ORTEXT FROM OSMXDE061.OSMORUL@OSMOSYS.DB2
WHERE ORRULCD IN ((select rlcode from OSMXDE061.OSMRUL@OSMOSYS.DB2))
order by orordref, orrulcd ;
tORORDREF number(10);
tORRULCD number(10);
tORSTAT varCHAR2(15);
tORTEXT varCHAR2(50);
tCountOSMORUL Integer;
BEGIN
OPEN ORRCD;
LOOP
FETCH ORRCD INTO tORORDREF , tORRULCD, tORSTAT, tORTEXT;
INSERT INTO OSMORUL (ORORDREF, ORRULCD, ORSTAT, ORTEXT) VALUES (tORORDREF , tORRULCD, tORSTAT, tORTEXT);
EXIT WHEN ORRCD%NOTFOUND;
End loop read_OrRCD;
end;
/
WP