Subject | Re: [firebird-support] Update query and trigger |
---|---|
Author | Ivan Přenosil |
Post date | 2013-10-09T18:46:15Z |
> query:if (new.field_b = old.field_b) then ...
> update mytable set field_a=XXX where yyyyy;
>
> mytrigger: before update
> if(new.field_b>0) then
> dosomething;
> else
> dosomethingelse;
>
> the trigger must operate only when i update field_b not when i'm updating field_A.
>
> Calling the first query new.field_b is always '0' and 'dosomethingelse' is executed; checking for "field_b is not null" is
> useless, it's '0'.
> There is a way to recognize that the query is not altering field_b?
or, if there can be nulls
if (new.field_b is not distinct from old.field_b) then ...
Ivan