‎2006 Jul 08 4:00 AM
Hi all, i have a question of locking object. to lock a table, we use two functions to lock and unlock a table. if i use "insert**" clause to update a table, can the enqueue_** work too? someone told me enqueue_*** can oly lock write access to table while using "update**" clause, but won't work if i use "insert**" clause, i'm not quite sure of that, anyone got the idear?
‎2006 Jul 08 4:04 AM
Its true, when you lock a table, its going to lock the current data. INSERT statement can still insert new rows into the table and that should not affect the existing data, right? Where as UPDATE will affect the existing data so the lock will not allow the updates.
Regards,
Ravi
Note : Please mark all the helpful answers and close the thread if the issue is resolved
‎2006 Jul 08 4:04 AM
Its true, when you lock a table, its going to lock the current data. INSERT statement can still insert new rows into the table and that should not affect the existing data, right? Where as UPDATE will affect the existing data so the lock will not allow the updates.
Regards,
Ravi
Note : Please mark all the helpful answers and close the thread if the issue is resolved
‎2006 Jul 08 4:08 AM
got it, thanks. i thought all write access should be forbidden by that lock object before. but if Person A is inserting a record to table, Person B is reading that table, or Person B is deleting records of that table, there will also be inconsistance, right? in that case, how to solve it?
Message was edited by: legend li
‎2006 Jul 08 4:11 AM
Usually any RDBMS will gaurantee the data as in the current state and it will not be right to lock the table for inserting data if some one else is updating a different row. Its not inconsistency, if some one has read the data 1 second before the new record was inserted. Its a matter of timing. When he refreshes the screen he is going to see the new data.
Regards,
Ravi
‎2006 Jul 08 5:55 AM
i think lock can only work to avoid inconsistance while more than one users are writing to the table:when update or delete, for the two clauses will change the existing entries in table, update will conflict with another update or delete to the same entry, so that is the reason why lock doesn't work while inserting.