Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: C/S Concurrency issue
> UPDATE T set COUNTER = COUNTER+1 where NAME = 'value';
> SELECT MAX(COUNTER) into :my_var FROM T where NAME = 'value';
That's no solution:
Client #1 updates the counter to 100 Client #2 updates the counter to 101 Client #1 selects 101 Client #2 selects 101
oops!
The sequence/serial... solution is best, but it looses points for not being portable.
You could put a unique index on the table being updated/inserted, check for failures and retry, but watch out for deadlocks. Received on Tue May 19 1998 - 20:13:49 CDT