Synesso
Synesso

Reputation: 38958

Oracle equivalent of ROWLOCK, UPDLOCK, READPAST query hints

In SQL Server I used the following hints inside queries:

e.g.

select top 1 data from tablez with (rowlock,updlock,readpast);

Are there equivalent in-query hints for Oracle?

Upvotes: 5

Views: 10687

Answers (1)

APC
APC

Reputation: 146199

The equivalent of ROWLOCK is the FOR UPDATE clause

select *
from emp
for update;

Since 11g Oracle has documented the SKIP LOCKED syntax which is the equivalent of READPAST:

select *
from emp
for update skip locked;

This syntax has worked for ages (it is fundamental to Advanced Queuing) but if it's not in the docs it's not supported,

There is no equivalent of UPDLOCK lock because Oracle flat out doesn't allow dirty reads. Find out more.

Upvotes: 7

Related Questions