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

sql_mode=ORACLE: Some keywords do not work in variable declarations

    XMLWordPrintable

Details

    Description

      In Oracle, all these keywords can be used for SP variables (in declarations and as INTO targets):

      • DO
      • HANDLER
      • REPAIR
      • SHUTDOWN
      • TRUNCATE
      • CLOSE
      • COMMIT
      • OPEN
      • ROLLBACK
      • SAVEPOINT
      • CONTAINS
      • LANGUAGE
      • NO
      • CHARSET
      • FOLLOWS
      • PRECEDES

      In MariaDB this script:

      SET sql_mode=ORACLE;
      DELIMITER /
       
      DECLARE
        do INT;
      BEGIN
        SELECT do INTO do FROM DUAL;
      END;
      /
       
      DECLARE
        handler INT;
      BEGIN
        SELECT handler INTO handler FROM DUAL;
      END;
      /
       
      DECLARE
        repair INT;
      BEGIN
        SELECT repair INTO repair FROM DUAL;
      END;
      /
       
      DECLARE
        shutdown INT;
      BEGIN
        SELECT shutdown INTO shutdown FROM DUAL;
      END;
      /
       
      DECLARE
        truncate INT;
      BEGIN
        SELECT truncate INTO truncate FROM DUAL;
      END;
      /
       
      DECLARE
        close INT;
      BEGIN
        SELECT close INTO close FROM DUAL;
      END;
      /
       
      DECLARE
        commit INT;
      BEGIN
        SELECT commit INTO commit FROM DUAL;
      END;
      /
       
      DECLARE
        open INT;
      BEGIN
        SELECT open INTO open FROM DUAL;
      END;
      /
       
      DECLARE
        rollback INT;
      BEGIN
        SELECT rollback INTO rollback FROM DUAL;
      END;
      /
       
      DECLARE
        savepoint INT;
      BEGIN
        SELECT savepoint INTO savepoint FROM DUAL;
      END;
      /
       
      DECLARE
        contains INT;
      BEGIN
        SELECT contains INTO contains FROM DUAL;
      END;
      /
       
      DECLARE
        language INT;
      BEGIN
        SELECT language INTO language FROM DUAL;
      END;
      /
       
      DECLARE
        no INT;
      BEGIN
        SELECT no INTO no FROM DUAL;
      END;
      /
       
      DECLARE
        charset INT;
      BEGIN
        SELECT charset INTO charset FROM DUAL;
      END;
      /
      DECLARE
        follows INT;
      BEGIN
        SELECT follows INTO follows FROM DUAL;
      END;
      /
       
      DECLARE
        precedes INT;
      BEGIN
        SELECT precedes INTO precedes FROM DUAL;
      END;
      /
      

      returns an error:

      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 'do INT;
      BEGIN
        SELECT do INTO do FROM DUAL;
      END' at line 2
      

      In Oracle the same script (without SET sql_mode and DELIMITER commands) works without errors.

      Attachments

        Issue Links

          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.