Subject | Re: [firebird-support] Match two fields in same table using a trigger |
---|---|
Author | PenWin |
Post date | 2011-03-11T08:01:16Z |
Dne 11.3.2011 8:51, thedevguy napsal(a):
particular implementation has some bugs, e.g. one of the fields contains
a NULL value and the usual "comparison of anything to null is almost
always false" GOTCHA kicks in.
Pepak
> Is there a way to sync two columns in the same table using a trigger. For example I have field1 and field2. On an insert or an update I would like field2 = field1 if they are different.This kind of triggers works fine for me. I am pretty sure your
>
> I tried something like the following but it doesn't work.
>
> TRIGGER:
> if (new.field1<> old.field2) then
> new.field2 = new.field1;
>
> Any help would be greatly appreciated.
particular implementation has some bugs, e.g. one of the fields contains
a NULL value and the usual "comparison of anything to null is almost
always false" GOTCHA kicks in.
Pepak