Re: Making Triggers Fire Only After a Commit
Posted in 1998
Tim Owens wrote: > > I currently have a trigger that is fired upon insertion. The trigger > works fine, but I need to determine if there is a way to prevent it > from firing until after the transaction is committed. > > I've looked through the Informix documentation, but so far have not > found the answer. > > Any help would be appreciated. Tim, I think you are missing a subtle point. Any time I execute a database operation statement that fires a trigger, all operations executed by the trigger - including any store procedures and resulting triggers from the statements in the stored procedure - are part of the same operation. In a logged database, it is like a mini transaction. If any part of the operation goes south, the entire operation is rolled back. (If you are in a transaction, the transaction itself is not automatically rolled back, so you can recover. But it's usually a good idea to roll it back anyway.) Bottom line: Since the trigger is part of the trasaction, what you seek is not possible. -- -- Jake (Pondering the color of an asphyxiated smurf) +------------------------------------------------------------+ | The expedient performance of a task with excessive concern | | regarding its duration-to-completion engenders a virtual | | certainty of diminished benefit therefrom. | | -- Benjamin Franklin (but he said it in 3 words) | +------------------------------------------------------------+