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

sql_mode=ORACLE: Variable declarations can go after cursor declarations

    XMLWordPrintable

Details

    Description

      In MariaDB variable declarations cannot go after cursor declarations.

      In Oracle there is no such restriction:

      DROP TABLE t1;
      DROP FUNCTION f1;
      CREATE TABLE t1 (a INT);
      INSERT INTO t1 VALUES (1);
      CREATE FUNCTION f1 RETURN INT
      AS
        CURSOR c IS SELECT a FROM t1;
        v_a INT;
      BEGIN
        OPEN c;
        FETCH c INTO v_a;
        CLOSE c;
        RETURN v_a;
      EXCEPTION
        WHEN OTHERS THEN RETURN -1;
      END;
      /
      SELECT f1() FROM DUAL;
      

            F1()
      ----------
      	 1
      

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 0.5d Original Estimate - 0.5d
                  0.5d
                  Remaining:
                  Remaining Estimate - 0d
                  0d
                  Logged:
                  Time Spent - 1d
                  1d

                  Git Integration

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