1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-10411 Providing compatibility for basic PL/SQL constructs

Part 19: CONTINUE statement
This commit is contained in:
Alexander Barkov
2016-08-24 15:23:04 +04:00
parent 442ea81ed3
commit ca242117ce
7 changed files with 298 additions and 0 deletions

View File

@ -797,3 +797,33 @@ SELECT f1(3), f1(4), f1(5), f1(6) FROM DUAL;
f1(3) f1(4) f1(5) f1(6)
6006 8008 10008 12010
DROP FUNCTION f1;
# Testing CONTINUE statement
CREATE FUNCTION f1(a INT) RETURN INT
AS
total INT:= 0;
BEGIN
FOR i IN 1 .. a
LOOP
CONTINUE WHEN i=5;
total:= total + 1;
END LOOP;
RETURN total;
END;
/
SHOW FUNCTION CODE f1;
Pos Instruction
0 set total@1 0
1 set i@2 1
2 set [upper_bound]@3 a@0
3 jump_if_not 10(10) (i@2 <= [upper_bound]@3)
4 jump_if_not 7(0) (i@2 = 5)
5 set i@2 (i@2 + 1)
6 jump 3
7 set total@1 (total@1 + 1)
8 set i@2 (i@2 + 1)
9 jump 3
10 freturn 3 total@1
SELECT f1(3), f1(4), f1(5), f1(6) FROM DUAL;
f1(3) f1(4) f1(5) f1(6)
3 4 4 5
DROP FUNCTION f1;