Re: Problem with ACE report...
Posted in 1996
Paul Harrington wrote: > > Having a slight problem with an ACE report. In the report.. > > var1 and var2 are both defined as ASCII, char(30), and are read into the > ace report from an ascii file. > > var1 is null, var2 contains some text. However, neither (var1 = var2) nor > (var1 != var2) return true in IF statements. > > Is this a bug or a feature ?? I'm running SE 4.00.UH1 and SQL 4.00.UH1, > but am planning to upgrade. > NULL handling is a topic of much contention. NULL in a Database sense means "not known", so two NULL values are not necessarily equal to each other, nor are they necessarily unequal. So ... to be safe, it's best to test NULL specifically: IF (var1 IS NULL AND var2 IS NOT NULL) OR (var1 IS NOT NULL AND var2 IS NULL) OR (var1 != var2) THEN ... A pain? yes. Any way around it? Not any that I'd vote for. I suppose you could have a stored procedure/4GL FUNCTION to do all this for you, so you would only have to type in: IF unequal(var1, var2) THEN ... The writing of the unequal() code itself is left as an exercise for the student. -- //////////////// ======================================================= ////////// // Dennis J. Pimple Informix Software, Inc. ////// / /// Principal Consultant 5299 DTC Blvd Suite 740 ///// // //// dennisp@informix.com Englewood CO 80111 //// // ///// /// // ////// recept: 303-850-0210 // // /////// direct: 303-740-5611 Opinions expressed are mine, / /////////// fax: 303-843-6408 and do not necessarily //////////////// http://www.informix.com reflect those of my employer