Hi Guys,
I am using loadUpdateData to import CSV file data, it is working fine with MySQL, but with oracle I am having an issue.
DECLARE
v_reccount NUMBER := 0;
BEGIN
SELECT COUNT(*) INTO v_reccount FROM translations WHERE context_pk = 'event.index' AND id_pk is NULL AND language_pk is NULL;
IF v_reccount = 0 THEN
INSERT INTO translations (context_pk, id_pk, language_pk, text) VALUES ('event.index', '1258', 'en', 'test');
ELSIF v_reccount = 1 THEN
UPDATE translations SET id_pk = '1258', language_pk = 'en', text = 'test' WHERE context_pk = 'event.index' AND id_pk is NULL AND language_pk is NULL;
END IF;
END;
Instead of pulling id_pk value from CSV, it is directly comparing to NULL and trying to execute the INSERT query all the time. Then Oracle is throwing "unique constraint (%s.%s) violated" error.
My CSV file data is
context_pk,id_pk,language_pk,text
event.index,1258,en,test
Please help me out from this.
Thanks,
Vijay