Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Need MERGE without UPDATE clause

Need MERGE without UPDATE clause

From: \ <forum_at_DBMonster.com>
Date: Thu, 07 Jul 2005 00:13:08 GMT
Message-ID: <50F02DE291C40@DBMonster.com>


I have a question regarding the MERGE statment. Can I do a merge with no update clause? For example, in the merge below, when a match is found, can I "do nothing"?

If I don't have a match, I want the insert, but if i have a match, i don't want to update the existing record with incoming data because the incoming data is not complete.

please help. it's been a long time, i'm rusty at this. thanks.


 MERGE INTO SALES_FACT D

     USING SALES_JUL01 S
     ON (D.TIME_ID = S.TIME_ID
              AND D.STORE_ID = S.STORE_ID
             AND D.REGION_ID = S.REGION_ID)
     WHEN MATCHED THEN
         UPDATE
                 SET d_parts = d_parts + s_parts
      WHEN NOT MATCHED THEN
     INSERT (D.TIME_ID ,D.STORE_ID ,D.REGION_ID,  D.PARTS ,D.SALES_AMT ,D.
TAX_AMT ,D.DISCOUNT)
     VALUES ( S.TIME_ID ,S.STORE_ID ,S.REGION_ID,S.PARTS ,S.SALES_AMT ,S.
TAX_AMT ,S.DISCOUNT);
-- 
Message posted via DBMonster.com
http://www.dbmonster.com/Uwe/Forums.aspx/oracle/200507/1
Received on Wed Jul 06 2005 - 19:13:08 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US