Bug #10820 | CASE...END CASE unable to use in function | ||
---|---|---|---|
Submitted: | 24 May 2005 10:32 | Modified: | 24 May 2005 12:34 |
Reporter: | Disha | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server | Severity: | S2 (Serious) |
Version: | 5.0.5-beta-nt | OS: | Windows (Windows xp) |
Assigned to: | CPU Architecture: | Any |
[24 May 2005 10:32]
Disha
[24 May 2005 10:52]
Vasily Kishkin
According to manual We must use "CASE...END CASE". But sometimes "END CASE" returns an error. You can use "END" instead of "END CASE". But I set status "Verified". Because I think this is bug. Example of workable code: CREATE FUNCTION strmon (mon INT) returns char(3) BEGIN RETURN CASE mon WHEN 1 THEN 'Jan' when 2 THEN 'Feb' END; END //
[24 May 2005 12:34]
Per-Erik Martin
You're confusing the CASE *statement* (used only in stored procedures) with the CASE *expression*. They have slightly different syntax, the latter with just END, not END CASE. (And RETURN of course expects the expression CASE) See sections 12.2 and 19.2.12.2 in the manual.