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

Home -> Community -> Mailing Lists -> Oracle-L -> Merge/update optimization

Merge/update optimization

From: Stephens, Chris <ChrisStephens_at_pqa.com>
Date: Thu, 28 Oct 2004 14:42:59 -0400
Message-ID: <0C36D9C74ADA844292F3218A9C6345442B9471@exchange.pqa.local>


=20

I'm writing a batch update/insert procedure and am wondering if there is a way to only update columns corresponding to the 'on' clause if they are different from the current value?...instead of update all columns regardles of whether or not that are the same.

So...

Table stage
Pk_id

Col_a
Col_b
Col_c

Table prod
Pk_id

Col_a
Col_b
Col_c

Merge into a.prod using select * from b.stage on (a.pk_id=3Db.pk_id) = When
matched then set a.col_a=3Db.col_a (but only if col_a has a different value) When not matched then insert...;

Thanks
chris

--
http://www.freelists.org/webpage/oracle-l
Received on Thu Oct 28 2004 - 13:38:37 CDT

Original text of this message

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