Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

In SQL Server I used the following hints inside queries:

  • rowlock (row level locking)
  • updlock (prevents dirty reads)
  • readpast (don't block waiting for a rowlock, go to the first unlocked row)

e.g.

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

Are there equivalent in-query hints for Oracle?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
788 views
Welcome To Ask or Share your Answers For Others

1 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...