Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-10142 PL/SQL parser
  3. MDEV-12088

sql_mode=ORACLE: Do not require BEGIN..END in multi-statement exception handlers in THEN clause

    XMLWordPrintable

Details

    • 10.2.2-3, 10.2.2-1, 10.2.2-2, 10.2.2-4, 10.1.18

    Description

      When running with sql_mode=ORACLE, MariaDB (the bb-10.2-compatibility branch) requires extra BEGIN..END in multi-statement exception handlers in THEN clause:

      SET sql_mode=ORACLE;
      DROP PROCEDURE p1;
      DELIMITER /
      CREATE PROCEDURE p1 AS
      BEGIN
        INSERT INTO t1 (a) VALUES (10);
      EXCEPTION
        WHEN DUP_VAL_ON_INDEX THEN
        BEGIN
          NULL;
          NULL;
        END;
        WHEN OTHERS THEN
        BEGIN
          NULL;
          NULL;
        END;
      END;
      /
      DELIMITER ;
      

      For better Oracle compatibility, we'll fix it not to require BEGIN..END, to make this work:

      SET sql_mode=ORACLE;
      DROP PROCEDURE p1;
      DELIMITER /
      CREATE PROCEDURE p1 AS
      BEGIN
        INSERT INTO t1 (a) VALUES (10);
      EXCEPTION
        WHEN DUP_VAL_ON_INDEX THEN
          NULL;
          NULL;
        WHEN OTHERS THEN
          NULL;
          NULL;
      END;
      /
      DELIMITER ;
      

      Attachments

        Activity

          People

            bar Alexander Barkov
            bar Alexander Barkov
            Votes:
            0 Vote for this issue
            Watchers:
            1 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.