Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Lock Table but only for external Sessions

HansMueller69Aug 29 2018 — edited Aug 31 2018

Hello

I need to execute many DML-Operations on a table but I want to lock the table for external sessions during this interaction.

Problem: I want to execute COMMITs too.

How can I do this?

1.) LOCK TABLE or set it READ ONLY BUT only for other sessions

2.) UPDATE table -> COMMIT and more UPDATE/INSERT etc. COMMIT

3.) UNLOCK TABLE or set it back to READ WRITE

Problem:

If I use the LOCK TABLE IN EXCLUSIVE MODE or other Modes a COMMIT releases the lock

If I use the ALTER TABLE ... SET READ ONLY  -> then I can not update the rows any more in my own session.

How can I prevent other DMLs from other sessions on my table during DML processings?

Thank you all for your help,

Regards, Hans

This post has been answered by Sven W. on Aug 29 2018
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 28 2018
Added on Aug 29 2018
33 comments
1,523 views