View Single Post

   
  #2 (permalink)  
Old 02-27-2008, 08:36 AM
mike
 
Posts: n/a
Default Re: Variables in SP do not compare as equal when both are NULL

> In the followng stored procedure, 2 NULL columns (COMM) are selected into 2
> different SP variables and compared for equal. They are both NULL, but do
> not compare as equal. When the Not NULL columns (SALARY) are compared, they
> do compare as equal.
>
> Is there a reason for this?


Yep, that's the way it's supposed to be.

db2 "values (case when (nullif(0,0) = nullif(0,0)) then 1 else 0 end)"

1
-----------
0

1 record(s) selected.

db2 "values (case when (nullif(0,0) is null AND nullif(0,0) IS NULL)
then>

1
-----------
1

1 record(s) selected.

Reply With Quote