Subject | Re: [firebird-support] Re: The New command in triggers |
---|---|
Author | Milan Babuskov |
Post date | 2006-02-15T13:20:49Z |
Adam wrote:
NULLs, and then the values. The reason is that expression is evaluated
from left to right. So, if one of the values is NULL, you get:
NULL or TRUE
or
NULL or FALSE or TRUE
In any case, the final result in NULL, meaning that IF clause won't get
executed.
If you check for NULLs first, it runs into TRUE and stops the further
checking.
--
Milan Babuskov
http://njam.sourceforge.net
http://www.flamerobin.org
> If you consider NULL = NULL for the purpose of comparison, then youI believe this has to be done the other way around. First check for
> will need to check each field like this.
>
> IF ((OLD.FIELD <> NEW.FIELD) OR
> (OLD.FIELD IS NOT NULL AND NEW.FIELD IS NULL) OR
> (OLD.FIELD IS NULL AND NEW.FIELD IS NOT NULL)) THEN .....
NULLs, and then the values. The reason is that expression is evaluated
from left to right. So, if one of the values is NULL, you get:
NULL or TRUE
or
NULL or FALSE or TRUE
In any case, the final result in NULL, meaning that IF clause won't get
executed.
If you check for NULLs first, it runs into TRUE and stops the further
checking.
--
Milan Babuskov
http://njam.sourceforge.net
http://www.flamerobin.org