Exactly why I am even having this issue. I can ofcourse switch to using one space, though varchar will still trim it. This is an annoying standard I must say:-)
You are correct null represents the non existance of value, but in this case we are not making it equal to anything, but are rather using the comparison = to check for NULL. As we can do in many programming languages. Since SQL uses = sign for assignments and comparisons, I don't see a reason for it not to be able to check for an absense of value through foo=NULL. But this is an ANSI SQL issue and is now getting OT, so maybe if I have the time, I'll bother that list to get a clear explanation and why is this implemented in this way. Thanks, Stephen. Ilya -----Original Message----- From: Stephen Clouse To: Sterin, Ilya Cc: '[EMAIL PROTECTED]' Sent: 10/23/01 11:35 AM Subject: Re: = NULL vs. IS NULL -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Tue, Oct 23, 2001 at 09:39:55AM -0600, Sterin, Ilya wrote: > Ok, this might be a silly one. Though I have no problem solving this issue > by dynamically building the query, there should be a better solution due to > repreparing the statement... > > Within the where clause of the query that is prepared...' > > where foo = ? > > When binding an undef value when executing, this executes "where foo = > NULL". In Oracle there is a difference between foo = NULL and foo is NULL. This is not Oracle, but ANSI-standard behavior. NULL represents the absence or non-existence of a value. A non-existent value cannot be equal to anything. So this is the correct behavior. I personally don't think DBI should muck with proper behavior. (Now, Oracle has that annoying behavior of treating the zero-length string as NULL, which ANSI explicitly says *not* to do...but that's another story.) - -- Stephen Clouse <[EMAIL PROTECTED]> Senior Programmer, IQ Coordinator Project Lead The IQ Group, Inc. <http://www.theiqgroup.com/> -----BEGIN PGP SIGNATURE----- Version: PGP 6.5.8 iQA/AwUBO9WqfQOGqGs0PadnEQLp4QCgjkQkorg5yZyFo1ZoPXjMNehCBK0An0s6 qlEfwtFGaihJDk6L1zsYECwy =BJVL -----END PGP SIGNATURE-----
