On Wed, Apr 25, 2001 at 05:38:47PM +0200, Christian Hammers wrote:
> On Wed, Apr 25, 2001 at 04:34:26PM +0100, Tommy Wareing wrote:
> > Oracle have mentioned in the past that they might differentiate
> > between NULL and an empty string, but it's going to break so much
> > code, that I think we're safe with this...
> I would be horrified if any database would treat undef and "" the same.
> "Empty" is a value that you can assign a variable, undef means nobody has
> yet assigned anything to this variable.

My bad: undef is a better value in perl than "" to represent an unknown.

The bad news is that Oracle really does behave in exactly this
manner. Obviously non-character fields cannot store an empty string,
so there's no ambiguity there. But VARCHAR2s, which are the standard
variable length character type does not distinguish between them.

This is because most host languages don't provide any specific value
for "not assigned", and so you need an extra flag variable to indicate
that the main variable doesn't have a reliable value. Alternatively,
you restrict the range of the variable so that one value is never
available, but is instead treated as null (such as 0, or 65535 for
integers: you can see how that'd be a problem).

Either way, it can be a real hassle. :(

-- 
T.

Reply via email to