Subject Re: [firebird-support] Re: empty string=null ?
Author Paul Vinkenoog
Hello cantak3,

> "roskiy" <roskiy@...> wrote:
>>
>> In FB1.5
>> empty string<>null

> This is not correct.

I guess what roskiy meant was "An empty string and a Null are two
different things", which is correct. But he should have avoided the
'<>' operator because that suggests an SQL statement which returns
true (whereas in reality it doesn't).

> Let A = null and B = Empty Str.
>
> (A <> B) returns FALSE
> (A = B) returns FALSE

Watch out! They don't return False, they both return NULL. You may
think they're False because if the test expression of an "if"
statement is NULL, the "then" clause is skipped, but try this:

if (not (A <> B)) then...
if (not (A = B)) then...

If either A or B is NULL, the "then" block will be skipped in both
cases (and the "else" block, if present, executed), because not(NULL)
yields NULL -- after all, the inverse of an unknown is an unknown.


Greetings,
Paul Vinkenoog