Re: NULL-Problem, Bug or Feature
Posted in 1991
Alan Denney writes: >>> From uunet!rmy.emory.edu!informix-list-owner Thu Nov 21 02:16:10 1991 >>> From: uunet!pdact.pd.necisa.oz.au!ronl (Ron Lees) >>> To: informix-list@rmy.emory.edu >>> Subject: Re: NULL-Problem, Bug or Feature >>> >>> Joerg, >>> >>> What you've described sounds like another example of Informix's ternary logic >>> that occurs in using NULL values. It plagues 4GL programmers. > >"plagues"?? Given the need to support 3-valued logic, what does 4GL do *wrong* >in that context? > >>> If you need to use NULLS it is necessary to code 4GL programs as follows: >>> >>> if (a <> B) or >>> (a IS NOT NULL and b IS NULL) or >>> (a IS NULL and b IS NOT NULL) then .... > >I find this more straightforward to handle inequality-respecting-nulls: > > if (a = B) > then -- nothing > else ...desired action... > end if > >>> Ron Lees rlees@pdact.pd.necisa.oz.au >>> NEC Information Systems Australia Pty Ltd Voice: +61-6-2516411 >>> Software Development Centre (Canberra) Fax: +61-6-2516947 >>> PO Box 244, Belconnen ACT 2616, AUSTRALIA > >-- >Alan Denney aland@informix.com {pyramid|uunet}!infmx!aland > >"Democracy means buying a house you can't afford with money you don't >have to impress people you wish were dead." - Carson I am aware of the need to support the 3-valued logic in the SQL standard. I did not intend to imply that 4GL has it wrong and should not have used the term 'Informix's' in a proprietal sense. The point I was really making is that ternary logic is a trap for programmers not familiar with it. I have seen half a dozen programmers (including myself of course) make this mistake after they have moved to 4GL from some other programming environment. Every time you code an 'if' statement in 4GL you need to ask yourself whether the expression may evaluate NULL values. Either solution above works, but both look strange if you are not aware of the reason for it. +--------------------------------------------------------------------+ Ron Lees rlees@pdact.pd.necisa.oz.au NEC Information Systems Australia Pty Ltd Voice: +61-6-2516411 Software Development Centre (Canberra) Fax: +61-6-2516947 PO Box 244, Belconnen ACT 2616, AUSTRALIA +--------------------------------------------------------------------+