Bug #101127 Docu bug in CASE Statement

Submitted: 12 Oct 2020 9:59 Modified: 13 Oct 2020 8:38
Reporter: Oli Sennhauser Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:5.7/8.0 OS:Any (n.a.)
Assigned to: CPU Architecture:Any (n.a.)
Tags: case, SQL, statement

[12 Oct 2020 9:59] Oli Sennhauser
Description:
I would say you have a docu bug here (first example):

https://dev.mysql.com/doc/refman/8.0/en/case.html

How to repeat:
SQL> SELECT CASE ROUND(RAND()*3, 0) WHEN 1 THEN 'Value 1' WHEN 2 THEN 'Value 2' WHEN 3 THEN 'Value 2' ELSE 'All other values' END CASE;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CASE' at line 1

SQL> SELECT CASE ROUND(RAND()*3, 0) WHEN 1 THEN 'Value 1' WHEN 2 THEN 'Value 2' WHEN 3 THEN 'Value 2' ELSE 'All other values' END ;---------------------------------------------------------------------------------------------------------------------------------------
CASE ROUND(RAND()*3, 0) WHEN 1 THEN 'Value 1' WHEN 2 THEN 'Value 2' WHEN 3 THEN 'Value 2' ELSE 'All other values' END

---------------------------------------------------------------------------------------------------------------------------------------
Value 1

---------------------------------------------------------------------------------------------------------------------------------------

Suggested fix:
END CASE -> END only
[12 Oct 2020 10:16] MySQL Verification Team
Thank you for the bug report.
[12 Oct 2020 17:25] Paul DuBois
I can't find that example on the given page, or indeed anywhere in the refman.
[13 Oct 2020 1:28] Paul DuBois
Also, the example shown is an instance of a CASE operator, whereas the page referenced describes the CASE statement. The two are different things and have different syntax.
[13 Oct 2020 8:38] MySQL Verification Team
Changing to not a bug, see Paul explanation. Thanks.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.053 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.