How to ensure table is locked?
C PatelSep 26 2007 — edited Sep 27 2007I 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.