Re: NULL problem
Posted in 1995
Ti Lian Hwang (tilh@sin-co.sin-ro.DHL.COM) wrote:
: If the value of b in the
: select * from test where a = b
: is a NULL , the select statment will not find anything, even though the
: relevent record exists. See example below.
[example deleted]
: Is this a bug or a feature of 4GL :-)
It's a "feature" of the SQL language, it has to do with 3-valued logic.
The '=' operator returns a null truth value if either of its arguments
are null.
If you really want a single SQL statement, you could always use:
select * from test where a = b or (a is null and b is null);
but this might have a detrimental effect on your query performance,
depending on how well Informix can optimize the disjunction.
--
Jeff Sturm
jsturm@mail.msen.com