PL/SQL parser (MDEV-10142)

[MDEV-12098] sql_mode=ORACLE: Implicit cursor FOR loop Created: 2017-02-20  Updated: 2023-10-04  Resolved: 2017-03-10

Status: Closed
Project: MariaDB Server
Component/s: Parser, Stored routines
Affects Version/s: None
Fix Version/s: 10.3.0

Type: Technical task Priority: Major
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: Compatibility

Issue Links:
Blocks
blocks MDEV-12314 sql_mode=ORACLE: Implicit cursor FOR ... Closed
is blocked by MDEV-10581 sql_mode=ORACLE: Explicit cursor FOR ... Closed
Problem/Incident
causes MDEV-32275 getting error 'Illegal parameter data... Closed
Relates
relates to MDEV-16674 Document FOR loop Open
relates to MDEV-17278 CURSOR FOR LOOP - ERROR: unexpected e... Closed
Sprint: 10.2.2-3, 10.2.2-1, 10.2.2-2, 10.2.2-4, 10.1.18

 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();



 Comments   
Comment by Alexander Barkov [ 2017-03-10 ]

Pushed to bb-10.2-compatibility

Generated at Thu Feb 08 07:55:06 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.