Subject | Re: Violation of UNIQUE KEY constraint during UPDATE |
---|---|
Author | Adam |
Post date | 2005-08-04T23:33:45Z |
>the
> UPDATE MY_TABLE SET IX = IX + 1 (if IX is a unique integer key, and
> the table contains a continuous sequence of values for IX)
>
> Obviously, the unique key constraint is temporarily violated during
> the update if it isn't executed in descending order. But shouldn't
> constraint be checked only AFTER the execution of the statement?Hi Helmut,
>
Just a quick thought. Is it possible to create a stored procedure
that looks like this pseudo code
for select id from tablea order by id desc into :id do
begin
update tablea set id = id + 1 where id = :id;
end
The idea being to force the order by for the update. I do not know if
this would work at all, but may be worth a try.
Adam