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

sql_mode=ORACLE: Implicit cursor FOR loop

    XMLWordPrintable

Details

    Description

      In addition to FOR loops on explicitly declared cursors (MDEV-10581), we'll implement FOR loops for implicit cursors.

      The SQL query for the implicit cursor is declared directly inside the FOR loop:

      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (a INT, b INT);
      INSERT INTO t1 VALUES (10,20);
       
      DROP PROCEDURE IF EXISTS p1;
      DELIMITER /
      CREATE PROCEDURE p1 AS 
      BEGIN
        FOR rec IN (SELECT a, b FROM t1)
        LOOP
          SELECT rec.a, rec.b;
        END LOOP;
      END;
      /
      DELIMITER ;
      CALL p1();
      

      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:

                Time Tracking

                  Estimated:
                  Original Estimate - 0d
                  0d
                  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.