Re: Reading over locked rows
Posted in 1995
Joerg wrote: : } i've a program which unload tables to an ascii file and updates a specific : } column in the rows after they are written to the file. : } : } Isolation mode is set to repeatable read to avoid rows to be written to the : } file which are not committed. : } : } Everything was fine but if there are open transactions over some rows of a : } table i got repeated errors in the range -242 to -246 (depends if the table is : } indexed or not) until all transactions for this table are completed. Is there a : } way to "jump" over the locked rows? I wrote: : SET ISOLATION TO DIRTY READ : DECLARE c1 CURSOR FOR : SELECT ROWID FROM tabname WHERE { whatever your criteria are } : ORDER BY ROWID : : FOREACH c1 INTO intvar : SET ISOLATION TO COMMITTED READ : SELECT <cols> INTO <vars> FROM tabname WHERE ROWID = intvar : IF sqlca.sqlcode = 0 THEN { row is not locked or deleted } : { process as desired } : END IF : END FOREACH And Michael pointed out to me: > Problem Here....You must stop using ROWID, it goes away in 7.0 and above > use the UID instead. Ooops. Silly me... True, you should use a unique key instead. Although ROWID doesn't actually "go away", it just becomes unuseable on fragmented tables. Still, not a good idea. Forgot this last time, but: Please do not interpret anything I write here as being sanctioned by, supported by, or the policy of the company I work for, even though (or because) that happens to be Informix. June ---- June Tong Informix Asia/Pacific ---- ---- On-Loan Engineer Singapore ---- ---- Location-du-jour: Bangkok ---- ---- junet@informix.com (65) 298-1716 ----