Details
-
Bug
-
Status: Closed (View Workflow)
-
Minor
-
Resolution: Fixed
-
None
-
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?
Attachments
Activity
Field | Original Value | New Value |
---|---|---|
Fix Version/s | N/A [ 14700 ] | |
Resolution | Fixed [ 1 ] | |
Status | Open [ 1 ] | Closed [ 6 ] |
Workflow | MariaDB v3 [ 114480 ] | MariaDB v4 [ 158464 ] |
I think you were looking for https://mariadb.com/kb/en/case-operator/. I've adjusted the text to reduce the chances of confusion.