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 9: EXCEPTION handlers

EXCEPTION is now supported in inner blocks.
This commit is contained in:
Alexander Barkov
2016-08-16 10:24:12 +04:00
parent d2b007d6bc
commit 4b61495576
7 changed files with 495 additions and 12 deletions

View File

@ -465,3 +465,31 @@ SELECT @v;
@v
113
DROP PROCEDURE sp1;
CREATE PROCEDURE sp1 (v IN OUT INT, error IN INT)
IS
BEGIN
BEGIN
BEGIN
SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=error, MESSAGE_TEXT='User defined error!';
v:= 223;
EXCEPTION
WHEN 30001 THEN
BEGIN
v:= 113;
END;
END;
END;
END;
/
SET @v=10;
CALL sp1(@v, 30001);
SELECT @v;
@v
113
SET @v=10;
CALL sp1(@v, 30002);
ERROR 45000: User defined error!
SELECT @v;
@v
10
DROP PROCEDURE sp1;