foreach loops once when contains transaction: BUG?
Posted in 2000
Topics: Stored Procedures & SPL
I have one stored procedure that contains a foreach loop that calls a second stored procedure. If the second procedure contains a BEGIN WORK...COMMIT WORK block, then the foreach loop in the outer procedure only executes once. I do not get any errors, the loop just seems to ignore the other ~7000 items it is supposed to process. If I comment out the BEGIN WORK, COMMIT WORK lines, then everything works as expected. There is no other transaction in force at the time. I can't find any docs saying that this is the expected behavior and I see plenty of examples of SPs that contain transactions, so I am assuming this is a bug? We are running 7.30.UC7 on Linux. Sent via Deja.com http://www.deja.com/ Before you buy.
kevine@my-deja.com wrote: > > I have one stored procedure that contains a > foreach loop that calls a second stored > procedure. If the second procedure contains a > BEGIN WORK...COMMIT WORK block, then the foreach > loop in the outer procedure only executes once. > I do not get any errors, the loop just seems to > ignore the other ~7000 items it is supposed to > process. If I comment out the BEGIN WORK, COMMIT > WORK lines, then everything works as expected. > There is no other transaction in force at the > time. > > I can't find any docs saying that this is the > expected behavior and I see plenty of examples of > SPs that contain transactions, so I am assuming > this is a bug? > > We are running 7.30.UC7 on Linux. > Did you declare the related cursor WITH HOLD? By default, a commit work will close all cursors. -- John Carlson Informix DBA WHSmith USA #include std_disclaimer.h /* These are my opinions, not my company's opinion */