I've got two Oracle queries running in different sessions, which are deadlocking, and I'm having trouble seeing why that's happening.
The query in session 1 is this:
UPDATE REFS R SET R.REFS_NAME = :B2 WHERE R.REFS_CODE = :B1
The query in session 2 is this:
UPDATE REFS R SET R.STATUS_CODE = :B3, R.STATUS_TYPE = :B2 WHERE R.REFS_CODE = :B1
Each is surrounded by a cursor that loops through a selection of primary key values. When these queries are run at the same time, they deadlock. REFS_CODE is the primary key, and the Oracle trace shows that they're updating different rowids. The primary key is indexed, obviously, and there are some foreign key constraints, which are supported by indexes as this has been a problem for us in the past.
Moving into the realm of desperation, I've tried disabling triggers on the table, and that didn't help. Also tried using autonomous transactions, but that made things much worse.
Is there something I'm missing? Thanks for any help!