Re: Re Where != and NULLS
Posted in 1996
Tim Schaefer wrote: > > Malcolm Weallans wrote: > > <wrote lots of stuff about NULL> A debate on NULL! Great! Here is my 0.00001 pennies worth; NULL in Informix terms is 'not known' and is stored as far as I know as a NULL. If variables are used without initialising them first in the tools they have arbitary values taken from that memory location. RDS is an exception to this rule because it will very kindly initialise variables for you. One of the major headaches when porting from RDS to fully-compiled 4GL. A valid use of NULL in the database is when you know that you don't know the value. If that makes sense. Suppose you have a customer detail table. You would generally know the company name and fill that in. If you did not know the address of that company you would set it to NULL or 'not known'. This also applies to numerics. If you did not know someone's weight, you would set it to NULL. If you then performed calculations on everone's weight you should ignore all those 'not known' values, which is what Informix do in their aggregate functions. The thing that confuses a lot of people is when they DO include NULL in calculations. NULL + 1 = NULL, or 'not know' + 1 still gives you 'not known'. Hope that helps, -- Mark. +-------------------------------------------------------------------------+ |Mark D. Stock - The West Solutions Group http://www.west.co.za | | | |mailto:marks@west.co.za +------------------------------------------------+ |Tel: +27 11 803 2151 |If it doesn't work... force it! | |Fax: +27 11 803 2189 |If it breaks... it needed replacing anyway! | |Cell: +27 83 250 2325 |Well, that's how I code anyway! | +------------------------+------------------------------------------------+