Oh, it makes perfect sense within the formal framework of SQL. "no
value" is not the same as "a value which is empty".
The difference isn't as obvious with strings, but "i = 0" is not the
same as "I have no value for i". Unknowns are important.
In Tcl we do it typically by saying [info exists i] ... that's how you
tell if i has a value or not.
Right, but... i=NULL never does anything in SQL - it can't give you
something meaningful. So you could just declare that "i=NULL" is what
you should use instead of "i is null" and be done with it.
Sure, tcl uses "info exists" but other languages like C and PHP use
=NULL to check if something "exists" or not (I use quotes because the
notion of "existence" isn't quite the same in C as it is in tcl, because
every variable used in C must be declared so every variable "exists",
but C uses NULL to indicate that, for example, pointers aren't set to
anything. Actually this is very similar to SQL because the row/column
you're selecting does "exist" it just isn't set to anything in particular)
If it wasn't useful to know if i has a value or not, well, why have info
exists?
Sure but that's just a convention within tcl. Since
if { $i == NULL } { }
isn't valid in tcl for anything else, tcl could have just as easily sued
that instead of info exists. It just isn't a very "tcl" way to do it.
Postgres still makes me use "is null"
Better is to say "SQL ..." not "Postgres" - Postgres implements the
standard.
Well, I tried postgres and oracle. I didn't try any others and I didn't
want lectures about which database does what so I stuck with what I
tested ;)
Anyway, they can keep is null, I'm fine with that, but it would be nice
if =null was expected to work also, in the same way that you can use
strlen(mystr) == 0
and
mystring == ""
(in C++ obv, C doesn't do string comparison like that)
It's really just an issue of style and an occaisonal annoyance. It
doesn't bother me nearly as much as oracle swallowing '' as null.
Rusty
--
AOLserver - http://www.aolserver.com/
To Remove yourself from this list, simply send an email to
<lists...@listserv.aol.com> with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject:
field of your email blank.