Subject Re: Why is this telling me
Author Adam
--- In firebird-support@yahoogroups.com, Jason Dodson <jasond@b...>
wrote:
> It is also terrible to allow String fields to be NULL in the first
place. The ONLY time things should be allowed to carry NULL is if
there is no other
> means to indicate 'No Value', such as a date. Strings should
default to '', currency to $0, etc...
>
> Jason

Jason I disagree.

NULL means UNDEFINED or UNKNOWN.
It does not mean EMPTY STRING or ZERO.

It may possibly be '' or 0, but is may possibly be some other value.

You should only default a string to '' if it is indeed empty.

For example, the consider a persons middle name.

If you do not know the middle name or even if the middle name exists
or not, then NULL is the correct value.

If you do know that there is no middle name, then '' is the correct
value.

You can use the Coalesce function to easily run comparisons. Of
course the middle name is a trivial example, if you were to
incorrectly set it to '', then it probably wouldn't matter anyway,
but it is technically not correct. "You are saying that I know they
don't have a middle name", not "I am not sure of the middle name,
they didn't tell me"

Adam