From: "Sybrand Bakker" <postbus@sybrandb.demon.nl>
Subject: Re: Concurrency in Stored Procedure
Date: 2000/08/08
Message-ID: <965764306.16840.2.pluto.d4ee154e@news.demon.nl>#1/1
X-NNTP-Posting-Host: sybrandb.demon.nl:212.238.21.78
References: <TjYj5.30710$Z6.816176@newsread1.prod.itd.earthlink.net>
X-Trace: news.demon.nl 965764306 pluto:16840 NO-IDENT sybrandb.demon.nl:212.238.21.78
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600
Newsgroups: comp.databases.oracle.misc
X-Complaints-To: abuse@nl.demon.net


Add

for update of total_cash
to your first statement.
The affected row(s) will now be locked until you issue your update and
commit or rollback.

Hth,

Sybrand Bakker, Oracle DBA

"Michael Maddox" <mikemad@earthlink.net> wrote in message
news:TjYj5.30710$Z6.816176@newsread1.prod.itd.earthlink.net...
> I have some code similar to the following in an Oracle Stored Procedure:
>
>     Select TotalCash into v_TotalCash from Account Where Account ID = 100;
>
>     ..... Some verification code
>
>     Update Account Set TotalCash = v_TotalCash + p_AddedCash;
>
>
> I believe this is a concurrency issue because it's possible that after
> v_TotalCash is read, someone may update the value of TotalCash in the
> Account table by the time I get to my update command. Therefore, TotalCash
> would be wrong. This would be a better solution:
>
>     Update Account Set TotalCash = TotalCash + p_AddedCash;
>
> My question is, is this the only way to resolve a concurrency issue like
> this on Oracle since I don't think it does any kind of read locking?
>
> Thanks for the help!
>
> Michael Maddox
>
>
>
>
>
>




