Hi,I have a problem here that netheir optimistic nor persististic buffering can help. I need to lock the agent table in order to select the max no. Both buffering will not lock the table as this point. If that the case, how can i securely sure that no one else has used my max_no when i reach SQL insert ?
SET MULTILOCK ON
CURSORSETPROP("Buffering",5,"agent")
SELECT max(no) as w_max_no from agent into cursor tmp2 <------- point A. Select the max no.
SELECT agent
INSERT INTO agent (no,agent_code,agent_name) values ; <------- someone might have just inserted new record using my result selected at point A
(tmp2.w_max_no + 1,w_agent_code,w_desc)
BEGIN TRANSACTION
..The rest of my codes..
END TRANSACTION
How can i solve this without changing my table structure as i know auto-increament field will solve this trouble.
Thanks.
SET MULTILOCK ON
CURSORSETPROP("Buffering",5,"agent")
SELECT max(no) as w_max_no from agent into cursor tmp2 <------- point A. Select the max no.
SELECT agent
INSERT INTO agent (no,agent_code,agent_name) values ; <------- someone might have just inserted new record using my result selected at point A
(tmp2.w_max_no + 1,w_agent_code,w_desc)
BEGIN TRANSACTION
..The rest of my codes..
END TRANSACTION
How can i solve this without changing my table structure as i know auto-increament field will solve this trouble.
Thanks.