Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> MERGE - INSERT/UPDATE
Hi,
I am getting following errors while using MERGE.
ORA-02291: integrity constraint (PTEST.SYS_C0010720) violated - parent key
not found
I am i using following MERGE sql.
Sample MERGE sql for one ATTRIBUTE
MERGE INTO SKU_ATTR T USING (select sku_id,'BuyEP', EMP_FLAG from SKU_ATTR_UPLOAD) S ON (S.SKU_ID = T.SKU_ID and T.ATTRIBUTE_NAME = 'BuyEP') WHEN MATCHED THEN UPDATE SET T.ATTRIBUTE_VALUE = DECODE
(S.EMP_FLAG,'','NULL',S.EMP_FLAG)
WHEN NOT MATCHED THEN INSERT
DBMS_OUTPUT.PUT_LINE(TO_CHAR(SQL%ROWCOUNT) || ' rows merged.'); DBMS_OUTPUT.PUT_LINE(TO_CHAR(etl.get_merge_insert_count) || ' rows inserted.'); DBMS_OUTPUT.PUT_LINE(TO_CHAR(etl.get_merge_update_count( SQL%ROWCOUNT )) || ' rows updated.'); etl.reset_counters;
END;
/
How can use the MERGE or another techniques to INSERT the records if it's not there or if it's there and any changes I can update the records?
Thanks in advance!
Poratips
Received on Tue May 03 2005 - 11:36:12 CDT