I am working with an Oracle database (11g Release 2). Imagine multiple connections doing the following simultaneously:
- Start transaction
- Check if a specific value exists in a table of unique values
- If the value does not exist, insert it
- Commit transaction
It seems to me that the only way to prevent conflicts is to block connections from performing the above 4-step sequence while any other connection is currently performing the 4-step sequence.
Can transactions achieve this kind of broad locking/blocking in Oracle?
Thanks in advance for your answers and advice on how to best deal with this scenario.