Hi san,
errors -239 and -268 deal with the same problem, but in a different way.
Error -239 points to a duplicated value revealed by a UNIQUE INDEX.
Error -268 point to a duplicated value detected by a UNIQUE CONSTRAINT, which is not exactly the same if we consider the following:
- a UNIQUE CONSTRAINT will rely on an UNIQUE INDEX and will create it if not existing already.
- a UNIQUE INDEX doesn't oblige to have a UNIQUE CONSTRAINT.
In other words, you can have a unique index without any unique constraint, but you cannot have a unique constraint without a unique index. The interest of the unique constraint is that you cannot drop the unique index unless you drop the constraint.
So my guess is that you may have slight differences between your prod and test environment, ie one has the unique index and no unique constraint, giving an error -239, and the other one has the unique constraint, thus giving error -268.
Another possible cause would be if you use different ISOLATION LEVELS ( committed read OR REPEATABLE READ ), which would produce similar behaviour.
In any case, you will want to handle error -268 and -239 exactly the same way.
Hope this helps
Eric