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: Ora-00060 Deadlock Problem. Select for update behavior.

Re: Ora-00060 Deadlock Problem. Select for update behavior.

From: Martin Haltmayer <Martin.Haltmayer_at_0800-einwahl.de>
Date: Wed, 06 Jun 2001 10:55:11 +0200
Message-ID: <3B1DEFEF.FD18DE2@0800-einwahl.de>

The crucial point is that "select ... for update" always locks the *entire* resultset. After retrieving all result rows Oracle tries to lock, then it sorts them.

The sequence in which they are retrieved is undefined. So you cannot assume that process A and process B try to retrieve and to lock their respective rows in the same order. Therefore a deadlock may occur.

Easiest solution is to issue a "lock table in exclusive mode", then delete (without selecting for update), then commit. Another option would be to limit the resultset to one row by the condition "and rownum <= 1".

Martin Received on Wed Jun 06 2001 - 03:55:11 CDT

Original text of this message

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