In message <[EMAIL PROTECTED]>
Chaim Frenkel <[EMAIL PROTECTED]> wrote:
> I'd like to be able to mimic what the rules for nulls are in databases.
> (I only know sybase's rules, so there may be differences between vendors.
> Could somone that is aware of the ANSI standard chime in.)
Are you sure those are Sybase's rules? Some of them don't look right
to me although I'd have to check my various database manuals at work
to be sure.
> number + NULL = NULL
> number * NULL = NULL
> number - NULL = NULL
> number / NULL = NULL
Agreed.
> string + NULL = string
string + NULL = NULL is more common I think though I have certainly
seen both behaviours.
> value == NULL : false
Surely value == NULL is true iff value really is a null?
> NULL == NULL : false
Always true surely?
> value != NULL : false
> NULL != NULL : false
As for the above cases but inverted.
Using <, >, <= and >= with a null does always give false though IIRC.
> In sybase, summing or averaging a column with nulls simply ignores the
> nulls. How this would effect the proposed reduce function or perhaps
> that map/grep functions I don't have a clear proposal.
To be honest having to handle nulls can be a right pain. Having
written an expression evaluation engine for a report writer I know
this only too well ;-) Certainly there were a number of optimisations
that had to be removed because they weren't valid in the face of
null values.
Tom
--
Tom Hughes ([EMAIL PROTECTED])
http://www.compton.nu/
..."Bother", said Pooh, as he sunk his twelfth Guinness