Oracle equivalent of ROWLOCK, UPDLOCK, READPAST query hints

后端 未结 1 1396
悲哀的现实
悲哀的现实 2020-12-19 16:54

In SQL Server I used the following hints inside queries:

  • rowlock (row level locking)
  • updlock (prevents dirty reads)
  • readpast (don\'t block wa
相关标签:
1条回答
  • 2020-12-19 17:28

    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.

    0 讨论(0)
提交回复
热议问题