Merge stmt trying to insert duplicate while the ON clause is based on index
745400Jan 14 2010 — edited Jan 15 2010Hi,
I am using a merge statement to insert record in a table. The table has an unique index based on four columns. The merge statement matches on all four column (a.column1 = b.column1 and a.column2 = b.column2 ... etc.) in the ON clause. If a match is found then it does nothing if not found corresponding record is inserted.
But for some reason it is trying to insert duplicate and I am getting unique constraint violated exception.
The database is huge and the source table contains more than 200,000 records.
Any idea how it can happen?