Much ado about nothing.

From: David Cressey <david_at_dcressey.com>
Date: Thu, 22 Feb 2001 18:55:18 GMT
Message-ID: <qgdl6.35808$2X4.118541_at_petpeeve.ziplink.net>


Vadim,

I'll give an example of what I discovered in examining NULLS. I offer no guarantees whatsoever that any of my examples will be inspirational.

Oracle sells two database engines. The first one is the Oracle product that gave the corporation its name, and which everyone knows as "Oracle". The second one is DEC Rdb, which Oracle purchased from Digital Equipment Corporation (DEC) in 1994. I'll call the second one Rdb.

Rdb and Oracle have different ways of representing null values, in the internals of the server.

Rdb suffixes a bit vector to every row of every table. The bit vector indicates, for each column, whether the intersection of that column and the current row is or is not NULL. The bits are packed eight to a byte. The null bits indicate NOTHING ELSE.

Oracle, on the other hand, indicates NULLS by putting an "impossible value" in the column position itself. For numbers, the impossible value is something like a negative zero, and all actual zeroes are represented as positive zero.

With respect to VARCHAR2 type entries, Oracle uses a string length of zero to indicate a NULL. The character string of length zero is sometimes called the "null character string", but that nomenclature actually confuses the issue.

In any event, if one stores "the character string of length zero" in a VARCHAR column on Rdb, and later inquires as to whether the entry is NULL, the answer is FALSE. If one stores the same value in a VARCHAR2 column under Oracle, and later inquires as to whether the value is NULL, the answer is TRUE.

So between two products, both offered by the same, they can't even agree about nothing.

This is all very practical, and not very theoretical, so maybe it doesn't belong in this newsgroup.

A more interesting, and philosophical question is "what does nothing mean?"

--
Regards,
    David Cressey
    www.dcressey.com
Received on Thu Feb 22 2001 - 19:55:18 CET

Original text of this message