Update MERGE when matched is referenced on non - PI value

General
Highlighted
Enthusiast

Update MERGE when matched is referenced on non - PI value


Hi All,

I am following below topic

http://www.teradatamagazine.com/v10n01/Tech2Tech/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.

Tags (2)
1 REPLY
Enthusiast

Re: Update MERGE when matched is referenced on non - PI value

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.