|Subject||Re: [firebird-support] null in triggers|
> From: "Paul Vinkenoog"Wrong.
> > if (New.Quantity <> Old.Quantity) or
> > ((New.Quantity is null) and (Old.Quantity is not null)) or
> > ((New.Quantity is not null) and (Old.Quantity is null))
> You can make this shorter:
> if not ( New.Quantity = Old.Quantity
> New.Quantity is null and Old.Quantity is null )
> PS:If A is regular value and B is NULL, the result will be NULL ...
> Shortest general field equality test (with NULL considered equal to
> NULL) that I've been able to come up with is:
> A = B or A is null and B is null
> or with parens:
> ( A = B ) or ( A is null and B is null )
> The shortest inequality test is just the negation of this:... and hence negation of null is also NULL !!
> not ( A = B or A is null and B is null )
It is possible to write e.g.
IF ( New.Quantity = Old.Quantity OR New.Quantity is null and Old.Quantity is null )
THEN ... equal
ELSE ... not equal
but you can't reduce it into
IF (NOT ( New.Quantity = Old.Quantity OR New.Quantity is null and Old.Quantity is null ))
THEN ... not equal