oracle-databasequery-optimizationdatabase-administrationsqlperformanceoracle19c

Can two transactions modify the same row at the same time in Oracle?


What happens if two transactions try to modify the same row simultaneously? Normally, once the row is modified, the other transaction waits until the first one performs commit or rollback. But what if they send the update requests exactly at the same moment?


Solution

  • The answer is a big NO. Two transactions can not modify the same row at the same time. A transaction is a single logical unit of work that accesses and possibly modifies the contents of a database. Transactions access data using read and write operations. In order to maintain consistency in a database, before and after the transaction, certain properties are followed. These are called ACID properties.

    To go into more detail on how Oracle implements locks you may want to read about transaction isolation level oracle offers, latches, locks, and ITL.