[MDEV-12441] Variables declared after cursors with parameters lose value Created: 2017-04-04  Updated: 2018-08-31  Resolved: 2017-04-05

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

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

Issue Links:
Blocks
blocks MDEV-10142 PL/SQL parser Closed
Relates
relates to MDEV-10597 sql_mode=ORACLE: Cursors with parameters Closed
relates to MDEV-10598 sql_mode=ORACLE: Variable declaration... Closed

 Description   

This problem is repeatable in bb-10.2-compatibility:

This script:

SET sql_mode=ORACLE;
DROP PROCEDURE IF EXISTS p1;
DELIMITER $$
CREATE PROCEDURE p1() AS
  x0 INT:=100;
  CURSOR cur(cp1 INT, cp2 INT) IS SELECT cp1+cp2;
  x1 INT:=101;
BEGIN
  OPEN cur(10,11);
  CLOSE cur;
  SELECT x0, x1;
END;
$$
DELIMITER ;
CALL p1();

returns:

+------+------+
| x0   | x1   |
+------+------+
|  100 |   10 |
+------+------+

This is wrong. x1 should stay eqial to 101.



 Comments   
Comment by Alexander Barkov [ 2017-04-05 ]

Pushed into bb-10.2-compatibility

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