Duplicate rows in input LOAD data
When you load data into a table that is defined with a unique key, and the load action results in multiple records with the same value for the unique key (duplicate rows),
Log Master
generates SQL statements that can encounter errors or warnings when they are executed.
For a LOAD REPLACE LOG YES or a LOAD RESUME LOG YES on a table that does not have a row with the same unique key on the table before the load action, Db2 logs the insert records for the initial load action and the DELETE statements to delete duplicate rows. Log Master generates INSERT statements that correspond to the initial load action, but does not generate the DELETE statements for Db2’s subsequent actions to delete the duplicate keys. The second INSERT statement fails with a -803 SQL code.
The results of the load action and the executed SQL statements are the same.
For a LOAD REPLACE LOG NO on a table that does not have a row with the same unique key on the table before the load action, Log Master generates only one MASS DELETE statement that is associated with the LOAD REPLACE (because the initial load action is not logged).
The results of the load action and the executed SQL statements are the same.
For a LOAD RESUME LOG YES on a table that has a row with the same unique key on the table before the load action, Log Master generates an INSERT statement (initial load action), but does not generate the DELETE statement to delete the duplicate key. The INSERT statement fails with a -803 SQL code.
In this case, it is important that Log Master does not generate DELETE statements. Doing so would delete the pre-existing row from the table, and could result in data loss.
The results of the load action and the executed SQL statements are not the same.
- For a LOAD RESUME LOG NO, regardless of whether the table has a row with the same unique key on the table before the load action, Log Master does not generate any SQL statements associated with the load action.
Related topic