Oracle Update Hangs

后端 未结 6 1355
忘掉有多难
忘掉有多难 2020-12-10 05:04

I\'m having trouble with an Oracle update. The call to ExecuteNonQuery hangs indefinitely.

The code:

using (OracleCommand cmd = new OracleCommand(db         


        
6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-10 05:40

    When a simple update hangs it often means that you are blocked by another session. Oracle won't allow more than one transaction to update a row. Until a transaction has commited or rolled back its modifications it will lock the rows it has updated/deleted. This means that other session will have to wait if they want to modify the same rows.

    You should SELECT ... FOR UPDATE NOWAIT before you UPDATE if you don't want to hang indefinetely.

提交回复
热议问题