[MDEV-23940] Docu bug in CASE Statement Created: 2020-10-12  Updated: 2020-10-12  Resolved: 2020-10-12

Status: Closed
Project: MariaDB Server
Component/s: Documentation
Affects Version/s: None
Fix Version/s: N/A

Type: Bug Priority: Minor
Reporter: Oli Sennhauser Assignee: Ian Gilfillan
Resolution: Fixed Votes: 0
Labels: CASE, sql, syntax,
Environment:

n.a.



 Description   

I would say you have a docu bug here (first example):
https://mariadb.com/kb/en/case-statement/

END CASE -> END only

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 MariaDB 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

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

Possibly a Copy/Paste error from other source?



 Comments   
Comment by Ian Gilfillan [ 2020-10-12 ]

I think you were looking for https://mariadb.com/kb/en/case-operator/. I've adjusted the text to reduce the chances of confusion.

Generated at Thu Feb 08 09:26:12 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.