Subject RE: [ib-support] Re: OR in TRIGGERS
Author Thomas Steinmaurer
> Understood,
>
> but my question remains,
>
> Can you use 'OR', or some other kind of syntax which is equivalent
> to an OR condition, in triggers?
>
> i.e.,
>
> IF (old.SOMEVAL <> new.SOMEVAL) OR
> (old.SOMEOTHERVAL <> new.SOMEOTHER VAL) THEN
> ...
> ...
>
>
> I'm getting an error 'Token Unknown - OR'

Sure you can.

Try (note the outer parenthesis):

IF ((old.SOMEVAL <> new.SOMEVAL) OR
(old.SOMEOTHERVAL <> new.SOMEOTHERVAL)) THEN

Be aware, that NULL values must be handled separately.

For example, if old.SOMEVAL is NULL and new.SOMEVAL has a value,
the comparison of old.SOMEVAL<>new.SOMEVAL will fail!

HTH,
Thomas Steinmaurer
IB LogManager 2.1 - The Logging/Auditing Tool for InterBase and Firebird
http://www.iblogmanager.com