Subject | Update query and trigger |
---|---|
Author | Dr. Fabrizio Villanova |
Post date | 2013-10-09T13:57:14Z |
hi all,
for
example:
(
....
field_A varchar(x),
field_B integer default 0,
....
)
query:
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?
thank you.
Fabrizio