Re: Row locking

From: Lothar Armbruester <lothar.armbruester_at_rheingau.netsurf.de>
Date: 1997/12/01
Message-ID: <791.274T1571T13353478_at_rheingau.netsurf.de>#1/1


Bjoern Moritz wrote at 29-Nov-97 12:42:08

>I want to lock a row in Oracle7 without using the SELECT FOR UPDATE
>statement. Any ideas?

Hello!

The approach is quite simple:

select * from your_table
where primary_key='key value'
for update;

This attempts to lock the indicated row. If it is already locked by another session, the statement waits until it's freed. If this isn't what You want, You can use the following:

select * from your_table
where primary_key='key value'
for update nowait;

This also attempts to lock the row but gives an error if the row is already locked.

Hope that helps.

>Thanks,
 

>Björn Moritz

CU,
Lothar

--
Lothar Armbrüster       | lothar.armbruester_at_rheingau.netsurf.de
Schulstr. 12            | lothar.armbruester_at_t-online.de
D-65375 Oestrich-Winkel |
Received on Mon Dec 01 1997 - 00:00:00 CET

Original text of this message