Deadlock Possible (Ora-60) Using SELECT FOR UPDATE with ROWNUM and ORDER BY (Doc ID 391538.1)

Last updated on OCTOBER 12, 2011

Applies to:

Oracle Server - Enterprise Edition - Version: 8.1.7.0 to 10.2.0.2 - Release: 8.1.7 to 10.2
Information in this document applies to any platform.

Symptoms

Customer is using SELECT FOR UPDATE statement and recieving ora-60 errors.

The query is in the form of

SELECT  ...  WHERE  ...   ROWUM ...   ORDER BY ...   FOR UPDATE;

The believe is that the ORDER BY would force Oracle to lock the rows in a specific way to avoid deadlocks, but the reality is that this constuction does not provide that security if a session is executing multiple similar statements in the same transaction.

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms