Details
-
Technical task
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.3(EOL)
-
10.2.2-3, 10.2.2-1, 10.2.2-2, 10.2.2-4, 10.1.18
Description
This is similar to MDEV-12098, but for cursors with parameters.
The below script demonstrates using of a FOR loop with a cursor cur that has two parameters.
DROP TABLE IF EXISTS t1; |
DROP PROCEDURE IF EXISTS p1; |
SET sql_mode=ORACLE; |
CREATE TABLE t1 (a INT, b VARCHAR(32)); |
INSERT INTO t1 VALUES (10,'b0'); |
INSERT INTO t1 VALUES (11,'b1'); |
INSERT INTO t1 VALUES (12,'b2'); |
DELIMITER $$
|
CREATE PROCEDURE p1(pa INT, pb VARCHAR(32)) AS |
CURSOR cur(va INT, vb VARCHAR(32)) IS |
SELECT a, b FROM t1 WHERE a=va AND b=vb; |
BEGIN
|
FOR rec IN cur(pa,pb) |
LOOP
|
SELECT rec.a, rec.b; |
END LOOP; |
END; |
$$
|
DELIMITER ;
|
CALL p1(10,'B0'); |
CALL p1(11,'B1'); |
CALL p1(12,'B2'); |
CALL p1(12,'non-existing'); |
DROP TABLE t1; |
DROP PROCEDURE p1; |
The expected output is:
+-------+-------+
|
| rec.a | rec.b |
|
+-------+-------+
|
| 10 | b0 |
|
+-------+-------+
|
+-------+-------+
|
| rec.a | rec.b |
|
+-------+-------+
|
| 11 | b1 |
|
+-------+-------+
|
+-------+-------+
|
| rec.a | rec.b |
|
+-------+-------+
|
| 12 | b2 |
|
+-------+-------+
|
Attachments
Issue Links
- causes
-
MDEV-32275 getting error 'Illegal parameter data types row and bigint for operation '+' ' when using ITERATE in a FOR..DO
-
- Closed
-
- is blocked by
-
MDEV-12098 sql_mode=ORACLE: Implicit cursor FOR loop
-
- Closed
-
- relates to
-
MDEV-16674 Document FOR loop
-
- Open
-
Activity
Field | Original Value | New Value |
---|---|---|
Link |
This issue is blocked by |
Status | Open [ 1 ] | In Progress [ 3 ] |
Fix Version/s | 10.3.0 [ 22127 ] | |
Fix Version/s | 10.3 [ 22126 ] | |
Resolution | Fixed [ 1 ] | |
Status | In Progress [ 3 ] | Closed [ 6 ] |
Labels | Compatibility | Compatibility need_review |
Summary | Implicit cursor FOR LOOP for cursors with parameters | sql_mode=ORACLE: Implicit cursor FOR LOOP for cursors with parameters |
Labels | Compatibility need_review | Compatibility |
Link | This issue relates to MDEV-16674 [ MDEV-16674 ] |
Workflow | MariaDB v3 [ 80051 ] | MariaDB v4 [ 151830 ] |
Link |
This issue causes |