When MERGE detects duplicate rows during an INSERT operation, then Teradata Database takes different actions on the request depending on several factors.
Error‑causing rows are logged in an error table and are not rolled back.
The INSERT source relation for a MERGE statement can contain duplicate rows.
Like the case for an INSERT … SELECT statement, MERGE silently ignores duplicate row INSERT attempts into a SET table in Teradata session mode.
When the system inserts rows into the target table, the insertion of duplicate rows is governed by the normal constraint check rules enforced by the session mode types:
IN this session mode … |
The system handles duplicate row insert attempts by … |
ANSI |
not inserting them into the target table. It logs them as errors in the appropriate error table. The system inserts no rows into the target table under these circumstances. |
Teradata |
inserting the first row of the duplicate set into the target table and rejecting all the remaining rows from that set without logging them as errors. The system inserts one row into the target table under these circumstances. |
Unlike an INSERT … SELECT statement, MERGE does not silently ignore duplicate row insert attempts into a SET table in Teradata session mode.