LOCK TABLES usage
I have a situation where I’m not sure how to handle locking etc.
Setup:
1 Table (TAB1) holding an ID.
3 Tables (TABLE_A, _B, _C) where the ID is incremented and used for insert.
Logic (at various places depending on what table to insert in):
getID = SELECT ID+1 FROM TAB1
Update TAB1 SET ID=ID+1+[NumOfRowsToInsert]
Autocommit false
While MoreRowsToUpdate {
Insert into TABLE_A …
(…, ID, …) Values (…, getID, …)
getID++
}
If OK
commit
else
rollback
AutoCommit=true
Question:
How can I make sure that the getID and UPDATE TAB1 is in sync (i.e. no other user can do an update in between) ?
Subject
Written By
Posted
LOCK TABLES usage
August 19, 2005 07:39AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.