List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:October 25 2002 4:16pm
Subject:Re: Strange behavior of CASE .. WHEN ... THEN....
View as plain text  
At 11:41 +0200 10/25/02, Harald Fuchs wrote:
>In article <000701c27193$1bf2bfa0$aa3fe7cb@jsheo>,
>"Heo, Jungsu" <jsheo@stripped> writes:
>
>>  Hello, every one.
>>  I Found a bug about CASE .. WHEN .. THEN..
>
>mysql> SELECT VERSION() ;
>>  +------------+
>>  | VERSION()  |
>>  +------------+
>>  | 4.0.3-beta |
>>  +------------+
>>  1 row in set (0.00 sec)
>
>mysql> select CASE NULL WHEN  NULL THEN 0 ELSE 1 END AS RESULT ;
>>  +--------+
>>  | RESULT |
>>  +--------+
>>  |      1 |
>>  +--------+
>>  1 row in set (0.00 sec)
>
>>  I think RESULT should be '0'. Am I wrong?
>
>>  IF() works finely.
>
>
>mysql> SELECT IF( NULL IS NULL, 0 , 1 ) AS RESULT ;
>>  +--------+
>>  | RESULT |
>>  +--------+
>>  |      0 |
>>  +--------+
>>  1 row in set (0.00 sec)
>
>>  Is this a bug or a mistake of mine?
>
>The latter one.  While "NULL IS NULL" returns true, "NULL = anything"
>returns false, even if "anything" is NULL.
>
>[Filter fodder: SQL query]

If you're using the CASE to test whether a part
Thread
Strange behavior of CASE .. WHEN ... THEN....Jungsu Heo25 Oct
  • Re: Strange behavior of CASE .. WHEN ... THEN....Harald Fuchs25 Oct
    • Re: Strange behavior of CASE .. WHEN ... THEN....Paul DuBois25 Oct
    • RE: Strange behavior of CASE .. WHEN ... THEN....Adam Nelson25 Oct