HELP! Selecting and locking rows in a transaction
Posted in 1993
I'm using Informix 4.00 on SCO UNIX System V/386 and I have the following
problem:
within a transaction I need to select some records from a table (in a database
created in MODE ANSI) and lock them in exclusive mode to avoid that other users
modify these records until the end of the transaction.
My test contains this 4GL code:
SET ISOLATION TO REPEATABLE READ
DECLARE jcurscab CURSOR FOR
SELECT columns FROM table
WHERE condition
FOR UPDATE
FOREACH jcurscab INTO record[].*
..
..
END FOREACH
wait for user input
COMMIT
Using the code in two different programs with different condition I
noted that if one of them is blocked waiting for input another copy of
the program the SELECT fails with error -243.
Do these statements lock all the table or just the rows that satisfy the
condition ? How do I lock ONLY the records that match condition ?
Thank you for your help.