Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

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.

share|improve this answer
    
Perfect :) Thank you –  Xophmeister Apr 24 '13 at 14:06
    
Well explained & to the point. +1 –  FreshPhilOfSO Apr 24 '13 at 15:11
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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