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 -> "read only" lock in Oracle?

"read only" lock in Oracle?

From: Serge Krasnyansky <junkmbox_at_yahoo.com>
Date: 8 Mar 2002 15:05:07 -0800
Message-ID: <1c6a0599.0203081505.45d0b1d4@posting.google.com>


Hello to the Oracle database gurus out there!

We are porting our app. from Informix to Oracle. Our problem is the differences in locking behavior between the two databases. In particular, the following example demonstrates how Informix places a "read-only" type of lock.

Suppose, we create a table with two rows (and we are in row-locking mode, as opposed to page-locking):

CREATE TABLE A (I INT);
INSERT INTO A VALUES (22);
INSERT INTO A VALUES (33);
COMMIT;

***Session 1:
SELECT * FROM A WHERE I = 22;
//success, places read-lock

***Session 2:
SELECT * FROM A WHERE I = 22;
//success, places read-lock

UPDATE A SET I = 25 WHERE I = 22;
//fails or waits due to lock owned by session1

DELETE FROM A WHERE I = 22;
//fails or waits due to lock owned by session1

UPDATE A SET I = 35 WHERE I = 33;
// success, because this row had no locks

***Session 1:
UPDATE A SET I = 25 WHERE I = 22;
//fails or waits due to lock owned by session2

DELETE FROM A WHERE I = 22;
//fails or waits due to lock owned by session2

This is Informix' default behavior. The questions is, what would be the SQL statements for the given example that reproduce the same locking behavior in Oracle.

Any help would be highly appreciated.
Serge Received on Fri Mar 08 2002 - 17:05:07 CST

Original text of this message

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