Target row updated by multiple source rows.

Database

Target row updated by multiple source rows.

Hi All,

I am running below update statement in proc --

update a

from

a,

tmp /*temporary table */

set flag = 'N'

where

a.COL1 = tmp.COL1 and

a.COL2 = tmp.COL2 and

a.flag <> 'N';

Error : - Update Failed :7547:Target row updated by multiple source rows

-------

Note:- for COL1,COL2 combination in where clause i am getting single row. So for COL1,COL2 combination only single row from table 'a' shud get updated

Please help.

2 REPLIES
Enthusiast

Re: Target row updated by multiple source rows.

You can find out the dupes/ cross join that is causing the issue with the sql below: 

select a.COL1,a.COL2, count(*)
FROM
  a,
tmp

WHERE a.COL1 = tmp.COL1 and
a.COL2 = tmp.COL2 and
a.flag <> 'N'

group by 1,2
having count(*) > 1;

WAQ
Enthusiast

Re: Target row updated by multiple source rows.

Note:- for COL1,COL2 combination in where clause i am getting single row

Doesn't look from the error.