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!

How to ensure table is locked?

C PatelSep 26 2007 — edited Sep 27 2007
I have a couple tables that should be locked during batch transaction processing to prevent records from be changed by other users. I've considered peforming a LOCK TABLE [table_name] IN ROW SHARE MODE NOWAIT, but I was told by the DBA that is not a good idea, and that Oracle will handle the locking on its own. Since I'm selecting from TABLE A, performing calculations and then INSERTING TABLE_B, inserting/updating (using MERGE statements) TABLE_C, how/when are locks being performed by Oracle? I am not using SELECT...FOR UPDATE which does locks.

Even if I did an exclusive lock, wouldn't the lock be released, once a commit interval is reached in my loop and I perform a COMMIT? DBA recommends commit every 5k or 10k records. I've read about commit intervals not being a good idea, but in this case I think I need it since I'm unable to perform bulk inserts with the way my processing logic is.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 25 2007
Added on Sep 26 2007
12 comments
920 views