In most of cases user execute the same program at the same time.They access the database table for read/write operation.
Where we use the lock object to lock the table for a single user at a time.In this case other user can't update the table at the same time.
I faced an issue where i was using the Lock object on the database table but it was generating the same Batch number at the same time.
Solution:
I used select statement in diffrent way that stops to access the respective database table at the same time.
SELECT SINGLE FOR UPDATE * FROM z09_2_3_2_1__001
WHERE nryear EQ l-nryear
AND z_nrmonth EQ l-nrmonth.
This select statement is locking the database table z09_2_3_2_1__001 until it gets updated.
Hence no other user can access this table at the same time.
After using this,there is no need to use the Lock objects.
No comments:
Post a Comment