At 11:41 +0200 10/25/02, Harald Fuchs wrote:
In article <000701c27193$1bf2bfa0$aa3fe7cb@jsheo>,
"Heo, Jungsu" <[EMAIL PROTECTED]> 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

---------------------------------------------------------------------
Before posting, please check:
  http://www.mysql.com/manual.php   (the manual)
  http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to