Oracle - How does Oracle manage transaction specific DML statements

前端 未结 4 1141
-上瘾入骨i
-上瘾入骨i 2021-01-22 11:57

Imagine I have this simple table:

Table Name: Table1
Columns:    Col1 NUMBER (Primary Key)
            Col2 NUMBER

If I insert a record into Ta

4条回答
  •  青春惊慌失措
    2021-01-22 12:39

    Just because you haven't done a commit yet does not mean the first record hasn't been sent to the server. Oracle already knows about you intentions to insert the first record. When you insert the second record Oracle knows for sure there is no way this will ever succeed without a constraint violation so it refuses.

    If another user were to insert the second record, Oracle will accept it if the first record has not been committed yet. If the second user commits before you do, your commit will fail.

提交回复
热议问题