Re: Informix 4gl infant question
Posted in 1994
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL, Data Types & Schema Design
Mike Rogoff (miker@nit.airtouch.com) wrote:
: Hi, if anyone could help me with the following question it would be
: much appreciated (it's probably trivial).
: In a query comparing column names in a table to program variables
: (with '='), the query seems to fail when the program variables are
: NULL. Even if the column is null, the query doesn't match the row.
: (Data type is char[]).
: Thanks.....
Hi Mike:
By definition, all comparisons with NULL values are false. You need to
use the "IS NULL" keywords:
Ex.
define
input_code char(6)
... code to input the code
if input_code is not null then
select cust_code from customers
where cust_code = input_code
else
select cust_code from customers
where cust_code is null
end if
Hope this helps.
--
/**************************************************************
* Ryan McFall *
* Dept. of Computer Science *
* Michigan State University *
* mcfallry@cps.msu.edu *
* *
* My statments do not reflect the opinions of MSU, *
* Heck, they probably don't even make sense! *
*************************************************************/