Bug #3287 Stored Procedure Case Statement Not SQL:2003 Compliant
Submitted: 24 Mar 2004 14:25 Modified: 29 Mar 2004 2:35
Reporter: Peter Gulutzan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.1-alpha-debug OS:Linux (SuSE 8.2)
Assigned to: Per-Erik Martin CPU Architecture:Any

[24 Mar 2004 14:25] Peter Gulutzan
Description:
In standard SQL, if a CASE statement has no ELSE and no condition is TRUE, the result 
should be an error: "case not found for case statement" (SQLSTATE = '20000'). Instead, 
MySQL proceeds as if no exception exists. 
  

How to repeat:
create function ff () returns int begin declare v int default null; case when v is not null then 
return (1); end case; return (2); end;// 
Query OK, 0 rows affected (0.00 sec) 
 
mysql> select ff()// 
+------+ 
| ff() | 
+------+ 
|    2 | 
+------+ 
1 row in set (0.00 sec)
[29 Mar 2004 2:35] Per-Erik Martin
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html