Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: prevent 2 users updating same row

Re: prevent 2 users updating same row

From: John Alexander <jalexander_at_summitsoftwaredesign.com>
Date: Tue, 03 Oct 2000 00:22:37 GMT
Message-ID: <hF9C5.17989$1H2.1581479@typhoon.tampabay.rr.com>

Use all the table's columns in the WHERE clause when updating, rather than just the primary key. Then check to see how many rows were updated. If any of the columns were changed by another user, then the WHERE clause will not get any hits, and no row will be updated. You can count the rows updated by SQL%ROWCOUNT.

John Alexander
www.SummitSoftwareDesign.com

<lfto_at_my-deja.com> wrote in message news:8rames$38r$1_at_nnrp1.deja.com...
> hi, i have the following situation where user A and B select the
> same row...then A updates and commits....then B update commits..
> problem is user B overlays user A updates....i need to prevent this.
>
> the select for update only locks other users from updating...not reading
> any ideas?
>
> here's my sql..
>
> user A: select * from miketable where user= 100;
> user B: select * from miketable where user=100;
> user A: Update miketable where user=100;
> commit;
> user B: update miketable where user=100;
> commit;
>
> thanks
> mike
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
Received on Mon Oct 02 2000 - 19:22:37 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US