Error in NULLIF documentation
am 14.10.2002 11:55:52 von Giuseppe Maxia>Description:
The documentation for NULLIF states that expr1 is evaluated twice if the expressions are equal.
Actually, it is the opposite. Expr1 is evaluated twice when the two exporessions are NOT equal.
>How-To-Repeat:
mysql> set @myval:=0;
Query OK, 0 rows affected (0.00 sec)
mysql> select NULLIF(@myval:=@myval+1,1); # now @myval is 1, it matches, NULLIF returns NULL
+----------------------------+
| NULLIF(@myval:=@myval+1,1) |
+----------------------------+
| NULL |
+----------------------------+
1 row in set (0.00 sec)
mysql> select NULLIF(@myval:=@myval+1,1); # After the first test, @myval is 2 ; doesn't match
+----------------------------+
| NULLIF(@myval:=@myval+1,1) |
+----------------------------+
| 3 |
+----------------------------+
1 row in set (0.00 sec)
# @myval is now 3, as a result of a double evaluation, when expr1 and expr2 were not equal.
>Fix:
Correct the documentation
>Submitter-Id:
>Originator: Giuseppe Maxia
>Organization:
>MySQL support: none
>Synopsis: error in documentation
>Severity: non-critical
>Priority: low
>Category: mysql
>Class: doc-bug
------------------------------------------------------------ ---------
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
To unsubscribe, e-mail
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php