Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-23940

Docu bug in CASE Statement

    XMLWordPrintable

Details

    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

          People

            greenman Ian Gilfillan
            oli Oli Sennhauser
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.