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 -> Merge statement? only want to update or insert merging field values if not nul

Merge statement? only want to update or insert merging field values if not nul

From: NormaJean S via DBMonster.com <forum_at_DBMonster.com>
Date: Sun, 10 Jul 2005 20:07:33 GMT
Message-ID: <5120534F64D80@DBMonster.com>


Hi,
I'm getting used to the merge statement. I really like it. I am using it in combination with external tables.
But I am pretty new at this (or pretty rusty, depending on your point of view) ....

I would like to know how i can add "update if not null" logic to my merge statement (i hope it is possible).

For example,

      MERGE
           INTO tab1
        USING tab2 ON (lower(tab1.title) = lower(tab2.title) )
  WHEN MATCHED THEN
       UPDATE SET
                tab1.code        = tab2.code
  WHEN NOT MATCHED THEN
       INSERT (id,code,title,description )
       VALUES (....[std stuff]..... );


in the update clause, i only want to update tab1.code with tab2.code if tab2. code is not null. Can I do that, if so, what's the syntax?

please advise....
thanks,
Norma Jean

-- 
Message posted via http://www.dbmonster.com
Received on Sun Jul 10 2005 - 15:07:33 CDT

Original text of this message

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