In oracle if I define a cursor and during the same time if there is an update on the Table then what happens to my Cursor? Does it become invalid or Updates does not matter?
+1
A:
Every query in Oracle is consistent with a point in time (usually the beginning of the query).
In your case if you open a cursor and while you fetch it someone modifies the rows Oracle will rebuild a logical copy of the data as it was when you opened the cursor. You won't see the modifications on the data made after this point in time.
This read consistency is a fundamental part of the Oracle engine.
From the Concept Guide, the read-consistency :
- Guarantees that the set of data seen by a statement is consistent with respect to a single point in time and does not change during statement execution (statement-level read consistency)
- Ensures that readers of database data do not wait for writers or other readers of the same data
- Ensures that writers of database data do not wait for readers of the same data
- Ensures that writers only wait for other writers if they attempt to update identical rows in concurrent transactions
Vincent Malgrat
2009-06-19 08:17:24