Start of change

-788 THE SAME ROW OF TARGET TABLE table-name WAS IDENTIFIED MORE THAN ONCE FOR AN UPDATE, DELETE, OR CHANGE OPERATION OF THE MERGE STATEMENT

Explanation

The ON search-condition of the MERGE statement matched a single row from the target table with multiple rows of the source table-reference. This could result in the target row being operated on more than once with an update or delete operation, and is not allowed.

table-name
The name of the target table of the MERGE statement.

System action

The statement cannot be processed.

Programmer response

Take one of the following actions:

  • Correct the search condition to ensure that each row in the target table matches only one row in the source table.
  • Aggregate the rows in the source table that match the row in the target table by using GROUP BY functions.
  • Use the ROW_NUMBER() OLAP expression to generate unique rows.

SQLSTATE

21506

End of change