Re: Multiple Actions in TRIGGERS - syntax help?
Posted in 1995
Dennis Pimple (dennisp@informix.com) wrote: : Graeme Sargent (graeme@pyramid.com) wrote: : : M. Stenzler (rpcg@panix.com) wrote: : : : Anyone know the correct syntax to implement a trigger that : : : performs multiple actions for a triggereing event? : : : ... : Enclose the entire block in parenthses, and comma-separate all but the : last statement within, like the 1st example you cited. : FOR EACH ROW : ( : do this thing, : do another thing, : ... : do the last thing : ); : : ... : : FOR EACH ROW (insert into t_2 values (...)), (insert into t_3 values (...)) : If this indeed works, apparently the parens around the whole block of I haven't tested it, I must admit, but normally the syntax diagrams are pretty good (apart from omissions). : statements is optional; I would bet *only if* there is only one block : of statements in the trigger (i.e.: no WHEN blocks along with the FOR : EACH ROW block) It's the WHEN that is optional: FOR EACH ROW ( [WHEN this] INSERT INTO t_2 VALUES (...) [, ...]) [, ( [WHEN that] INSERT INTO t_3 VALUES (...) [, ...]) ...] ; thus if you leave out the WHENs, and only put one item in each list, the second syntax *should* work, since there is no documented restriction on having the same WHEN clause multiple times. I'm not saying one would *want* to use this version, I was just saying that, *according to the manual*, it is legal. -- graeme -- Disclaimer: The author's opinions are his own, and not necessarily those of Pyramid Technology Ltd. or Pyramid Technology Inc. --------------------------------------------------------------------------- -m------- Graeme Sargent Voice: +44 (0)252 373035 ---mmm----- Senior Database Consultant Fax : +44 (0)252 373135 -----mmmmm--- Pyramid Technology Ltd. Telex: Tell who??? -------mmmmmmm- Farnborough, Hants GU14 7PL Email: graeme@pyra.co.uk --------------------------------------------------------------------------- We have the technology. The tricky bit is learning how to use it.