2
MDEV-15944
source link: https://jira.mariadb.org/browse/MDEV-15944
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Subquery is not allowed as the lower FOR loop bound
Details
-
Type: Bug
-
Status: Open (View Workflow)
-
Priority: Major
-
Resolution: Unresolved
-
Affects Version/s: 10.3
-
Component/s: Stored routines
-
Labels:
Description
DELIMITER $$
SET @v=0;
FOR a IN (SELECT 1) .. 3 DO SET @v = @v + a; END FOR;
$$
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '.. 3 DO SET @v = @v + a; END FOR' at line 1
If I use a subquery in the upper bound, it works fine:
DELIMITER $$
SET @v=0;
FOR a IN 1 ..(SELECT 3) DO SET @v = @v + a; END FOR;
SELECT @v;
$$
+------+
| @v |
+------+
| 6 |
+------+
Issue Links
relates to
MDEV-16558 Parenthesized expression does not work as a lower FOR loop bound
Activity
added a comment - 2018-06-25 07:18
Note, Oracle does not support subqueries in FOR loop bounds, neither in the lower, nor in the upper:
BEGIN
FOR a IN (SELECT 1 FROM DUAL)..2
LOOP
NULL;
END LOOP;
END;
/
BEGIN
FOR a IN 1 ..(SELECT 2 FROM DUAL)
LOOP
NULL;
END LOOP;
END;
/
People
Assignee:
Alexander Barkov Reporter:
Alexander Barkov
Votes:
0
Vote for this issue
Watchers:
1
Start watching this issue
Dates
Created:
2018-04-20 10:22
Updated:
2019-03-29 12:05
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK