Simulating serial fields: locking a row with select for update statement
Posted in 1998
Hi, We need to simulate the functionality of serial fields, because for various reasons we cannot use them. We have a field in a table that contains the number to be incremented - the serial (in fact we have a row in that table for each serial to be implemented) and we need to lock the row while the number is readed and updated. We thought to do it using 'select for update' but it seems not to work because other users can read the old value after the 'select for update' statement and before the commit. Do you know why the select for update statement doesn't lock the row? Anyone know if there is another way (or the best way) to simulate serial fields? The version of informix on-line we have is 7.23.UC7 The isolation level of the database is commited read ant the lock mode is set to not wait. Thank you in advance, ====================== Mario Garc'a Franco Cap de Projecte Centrisa - Val'ncia e-mail: mgarcia@vlc.centrisa.es tfn: 96 346 32 50 fax: 96 346 32 33 ======================