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?
1 Answer
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.
3 Comments
oramas
So, which transaction's update will be executed? Because they sent the requests simultaneously
Aman Singh Rajpoot
For you it is simultaneous but there are semaphores in place which will only allow one transaction to happen.
Aman Singh Rajpoot
Read on semaphores docs.oracle.com/cd/E19683-01/806-6867/6jfpgdcnj/index.html