| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> Re: MERGE - INSERT/UPDATE
Thanks for your response.
Looking to my MERGE sql, Any another method I can use or I have to write
the individual MERGE for each attribute type? I have another attribute like
Ecomm_flag, weight ...
MERGE.sql
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
'BuyEP',DECODE(S.EMP_FLAG,'','NULL',S.EMP_FLAG) );
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;
-- Message posted via http://www.dbmonster.comReceived on Sat May 07 2005 - 04:21:59 CDT
![]() |
![]() |