db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bernt M. Johnsen" <Bernt.John...@Sun.COM>
Subject Re: SQL Exception
Date Wed, 01 Mar 2006 19:30:21 GMT
>>>>>>>>>>>> Bernt M. Johnsen wrote (2006-03-01 20:21:08):
> But formally Java "null" and SQL "NULL" is two different concepts. In
> addition, the tutorial (3.0 ed.) has the same interpretation as me.

To illustrate this: 

Consider the following Java:

   X x;
   X y;

   if (x == y) {
   ...
   } 

The test would evaluate to true if x and y refers the same object or
if both are null.

Now consider the following SQL

   create table t1 (x integer);
   create table t2 (y integer);

   select * from t1,t2 where x = y;

Here the test would evaluate to TRUE if neiher value is NULL and x
equals x, FALSE if they are not NULL and not equal and UNKNOWN if one
*or both* are NULL.


-- 
Bernt Marius Johnsen, Database Technology Group, 
Staff Engineer, Technical Lead Derby/Java DB
Sun Microsystems, Trondheim, Norway

Mime
View raw message