phoebe_ccy
Member
- Joined
- Oct 12, 2009
- Messages
- 6
- Programming Experience
- Beginner
Hi,
I am currently working on an Inventory system. In Program A, I need to allocate Item X for a process. Therefore, I need to lock the item in Inventory table so that other program cannot use Item X anymore.
Here is how I locked Item X in Inventory table (from program A):
SELECT * FROM FIINVTBL
WHERE INV_ITEM = 'X'
FOR UPDATE;
At the same time, Program B is trying to get Item X too. How can I know that records for Item X in FIINVTBL is locked? I need to prompt out a message in Program B so that alert user. How can I know that the record is locked when I select the item from inventory table?
Please help.
I am currently working on an Inventory system. In Program A, I need to allocate Item X for a process. Therefore, I need to lock the item in Inventory table so that other program cannot use Item X anymore.
Here is how I locked Item X in Inventory table (from program A):
SELECT * FROM FIINVTBL
WHERE INV_ITEM = 'X'
FOR UPDATE;
At the same time, Program B is trying to get Item X too. How can I know that records for Item X in FIINVTBL is locked? I need to prompt out a message in Program B so that alert user. How can I know that the record is locked when I select the item from inventory table?
Please help.