1

This seems like an obvious question, but Googling has so far failed me...

Say I have a view which delineates updates that I need to apply and, to this end, I have an SP that opens the view as a cursor, iterates through each row and makes the appropriate change. The thing is, the updates made by the SP will alter the contents of the view (e.g., once the inconsistency has been dealt with, the row will disappear from the view).

Will this be reflected in the open cursor (in the SP), or is the data that it fetches fixed when it is first opened?

What I've read suggests that the cursor data is immutable once it's been opened -- which is good -- however, I've yet to find a straight answer.

1 Answer 1

3

Oracle will provide a read-consistent view of the data. Assuming that you're using the default transaction isolation level of read committed, the data that a query will return is fixed at the point in time that the cursor is opened (whether the cursor is implicit or explicit is irrelevant).

The only exception to this is that PL/SQL that is called by the query (i.e. stored functions) will see the data as it exists at the point in time that the function is called not at the point that the cursor was opened.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.