Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> comp.databases.theory -> Re: So what's null then if it's not nothing?

Re: So what's null then if it's not nothing?

From: Jon Heggland <heggland_at_idi.ntnu.no>
Date: Fri, 25 Nov 2005 14:30:23 +0100
Message-ID: <MPG.1df1305d7cd63f9998970d@news.ntnu.no>


In article <1132912144.091433.13610_at_z14g2000cwz.googlegroups.com>, michael_at_preece.net says...
> > Ok. Let's say that the empty string can be called "no value at all" for
> > a text variable. What is "no value at all" for an integer variable?
> > --
> > Jon
>
> Well Jon - I'd say they're both NULL. NULL is type-less.

That is a bit troublesome if you like strong typing, as I do. But let that pass.

> In the case of
> "no value at all" for an integer variable we can't store an empty
> string so we would store NULL.

I wonder a little how you can say you can store NULL, but not the empty string, in the integer variable. If NULL is typeless, and "" is the same as NULL, surely "" is typeless too? What is the logical difference between decreeing that any variable can be NULL, and that any variable can be "", regardless of type? But let that pass.

> I know a lot of educated people will
> tell me that NULL, when compared to any other value, results in
> Unknown.

If we're talking SQL, probably. Alternatively, it results in NULL, which may or may not be something other than Unknown. But let that pass.

> I'd agree - if I agreed that NULL was unknown - or missing -
> or absent - or not, in fact, data. I believe that NULL is, correctly,
> "no value at all".

I don't understand this discussion. The behaviour of NULL in SQL is pretty well-defined, although it can be discussed how consistent and intuitive it is. But I can't see how it can be possible to have an objective definition of what it *means*. Unknown, missing, absent, "no value" are not mutually exclusive to me; neither are they really comparable. A value can be missing *because* it is unknown, no? And isn't "absent" and "missing" synonymous, and don't they imply that there is no value? My gut feeling is that the DB designer should specify what hir NULLs mean in each table. In fact, that should be done for all attributes, regardless of whether they allow NULLs or not. But let that pass.

My question is this:

You say the empty string is the same as "no value at all", and say we should call this concept of "no value at all" NULL for other data types. Now, the empty string is a perfectly normal string. You can do string operations on it: concatenate it, find its substring, find its length and so on. For an integer variable that is NULL, it is very different. You cannot do integer operations on it; you cannot add it to another integer, or multiply it, for example.

Doesn't this bother you? That for string variables, your NULL is just like any other string, but for integers (and all other types I can think of at the moment), it is something very peculiar?

-- 
Jon
Received on Fri Nov 25 2005 - 07:30:23 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US