Hi,
We have been having many issues with unique constraints and we seem to
have boiled it down to the equivalent of the following very simple
scenario...
given a table with a unqiue constraint on col1 and populated as
follows
col1 col2
---- ----
bob 1
fred 2
We now want to update/swap both rows without violating the unique
constraint
i.e
update test1 set col1='fred' where col2=1;
update test1 set col1='bob' where col2=2;
The first statement ALWAYS violates the unique constraint
irrespective of whether we do either of the following
1. Turn autocommit off, i.e do both in the same Txn.
2. Wrap the two statements in BEGIN ATOMIC ... END
How should/could this be done ?
i.e the constraint should not be checked until end of statement or Txn
?
Thanks.
Paul.