Re: cursors and transactions
Posted in 1998
Topics: Server Administration
It seems to me that the transaction is implicit if you're in ansi mode. If that's the case, the delete would close the cursor (unless it's declared WITH HOLD). Cheers Brian Finnegan Nicole Guffey wrote: > > I am using a select into cursor in a foreach statement in a stored > procedure. > For each row retrieved, I need to issue numerous delete statement to delete > records from a number of different tables based on information in the > retrieved row. > > EX: > FOREACH select x into y from tableA > if not exists (select * from tablez where oid = y) > begin > delete tableb where oid = y > delete tablec where oid = y > delete tabled where oid = y > end > END FOREACH > > My question has to do with when a cursor is closed. The syntax manual > states > that a select cursor will close when "The cursor is a select cursor without > a HOLD > specification, and a transaction completes using COMMIT or ROLLBACK > statements." > Is this referring only to explicitly closed transactions, or will informix > treat each individual > delete as an implied transaction and close the cursor? This seems like a > silly question to > have to ask, because I know what the answer should be, but I am new to the > Informix platform > and have learned not to make assumptions based on my knowledge/experience > with other db platforms. > > Thank you, > Nicole Guffey > DBA > J. Driscoll & Associates > nguffey@jdriscoll.com