|
I blame Oracle...
https://stackoverflow.com/questions/203493/why-does-oracle-9i-treat-an-empty-string-as-null
Not that I'm against NULLs...I'm very much for them. But they need to be
used carefully and only where they make sense.
For instance, in the OP's case, for an expiration date, I'd wouldn't use
them. I'd just set the date to 9999-12-31. I don't really need a contract
that doesn't expire. Having it expire when time does is good enough. ;)
In the case of most character fields, you don't usually really need to
differentiate between UNKNOWN and BLANK/EMPTY.
The one place NULLs really come in handy, is numeric fields that you intend
to use aggregate functions on. AVG(2,2,NULL,2) is 6 / 3=2 not 6 / 4 = 1.5.
Of course, that assumes you want 2 as a result and not 1.5. :)
I think many developers overuse NULL, as DBMS' default to NULLABLE.
Charles
On Wed, Sep 23, 2015 at 6:12 PM, Vernon Hamberg <vhamberg@xxxxxxxxxxxxxxx>
wrote:
Just to throw something into the fray that is really a non-winning--
attempt, but I'll do it anyway!
NULL - it is not really a value, it is an attribute. That's why the null
indicators make some sense - it's either true or false that the value of
something is known. Not that this makes things easy.
When columns are nullable, the row in storage has a bit array (I think -
maybe a byte array) up to 8000 long - the maximum number of columns in a
record.
There is no test in SQL for FIELD = NULL - the test is FIELD IS NULL.
The COALESCE function is always described as "...returning the 1st
non-null expression among it's arguments..." I suggest that "non" is a test
for "is", not "equals".
I really do think that if we remember this distinction, that things can be
a little less confusing. As Charles says, you can't say a comparison is
true or false when a column could BE NULL in some rows.
The trouble with this position is, even IBM in its documentation talks
about a column having the NULL value - I think! Even people in this list
find this to be common usage.
Anyhow, there I sit - ready to to be knocked off my NULL position on the
fence into either the TRUE or FALSE side - hope it's greener, wherever I
land!
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.