All Forums General
Langaliya.Nirav 15 posts Joined 04/11
20 Jun 2011
Update MERGE when matched is referenced on non - PI value

Hi All,

I am following below topic Another-option-on-the-table/

I have some questions ,

1. How I can use MERGE for update query when match is on NON - PI value.

My query is like

update a
from table1 a, table 2 b
set a.col1=b.col1
where a.col2=b.col2
and a.col3 <> 'N'
and a.col2 <> ' '
and a.col2 is not null;

and here col2 is not PI value.

--Nirav Langaliya
AbeK 24 posts Joined 08/09
20 Jun 2011

Merge has two basic requirements , which cannot be avoided.
1. PI has to be involved in the ON clause
2. If the table has PPI , then the PPI columns have to be involved in the ON clause.

This is the only -ve, but that is also due to the reason why merge is more efficient.

You must sign in to leave a comment.