| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Re: Concurrency Questions
cnliou_at_eurosport.com (cnliou) wrote in message news:<eaa50a08.0207252122.3976fd6d_at_posting.google.com>...
> Thank you very much! Lauri,
>
> The solution you provided is so far the best one I think. The only
> problem with it is that the database (postgresql) will abort the
> transaction when trying to insert a record with duplicate key value.
I am not familiar with Postgres but that does sound strange!
You could try this small variant. It should get you past the duplicate-problem:
BEGIN TRANSACTION;
UPDATE inventory SET qty=NewItemQty WHERE ItemId=NewItemId;
IF <no-rows-updated> THEN
INSERT INTO inventory VALUES (NewItemId,NewItemQty);
<here a slight possibility of duplicate-error problems>
END IF
Lauri Pietarinen Received on Fri Jul 26 2002 - 06:58:09 CDT
![]() |
![]() |