Select for update

When using select for update, if the update is in a different transaction, will the lock on the row selected be released when the first transaction ends or when the second one ends? What happens if an error occurs and the first transaction is never closed?
Who is Participating?
girionisConnect With a Mentor Commented:
A select does not lock the row, only an update or an insert locks it and should be released upon calling commit.

> What happens if an error occurs and the first transaction is never closed?

The transaction will roll back so it will eventually be in it's original state.

Maybe you'd like to address the question i asked at the end of your last one authenticate...?
objectsConnect With a Mentor Commented:

The tx will end when you end it or roll it back.
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

mmuruganandamConnect With a Mentor Commented:
Whenever you are using the "select for update" that row(s) will be locked.  
Unless that transaction successfully ends/rollbacked, no other transaction can update that row(s).

I believe points should be split between all the participants.
split between girionis, objects and mmuruganandam.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.