Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-10764 PL/SQL parser - Phase 2
  3. MDEV-12333

Allow %ROWTYPE variable fields as FETCH INTO targets

    XMLWordPrintable

    Details

      Description

      Under term of this task we'll allow to specify fields of cursor%ROWTYPE and table%ROWTYPE variables as FETCH INTO targets:

      cursor%ROWTYPE fields as FETCH INTO targets:

      SET sql_mode=ORACLE;
      DROP PROCEDURE IF EXISTS p1;
      DELIMITER $$
      CREATE PROCEDURE p1 AS
        CURSOR cur IS SELECT 10 as a, 'b1' AS b;
        rec cur%ROWTYPE;
      BEGIN
        OPEN cur;
        FETCH cur INTO rec.a, rec.b;
        CLOSE cur;
        SELECT rec.a, rec.b;
      END;
      $$
      DELIMITER ;
      CALL p1;
      

      table%ROWTYPE field as FETCH INTO targets:

      SET sql_mode=ORACLE;
      DROP TABLE IF EXISTS t1;
      DROP PROCEDURE IF EXISTS p1;
      CREATE TABLE t1 (a INT, b VARCHAR(10));
      INSERT INTO t1 VALUES (10,'b1');
      DELIMITER $$
      CREATE PROCEDURE p1 AS
        CURSOR cur IS SELECT * FROM t1;
        rec t1%ROWTYPE;
      BEGIN
        OPEN cur;
        FETCH cur INTO rec.a, rec.b;
        CLOSE cur;
        SELECT rec.a, rec.b;
      END;
      $$
      DELIMITER ;
      CALL p1;
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              bar Alexander Barkov
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:

                  Git Integration