1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +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

@ -497,3 +497,31 @@ CALL sp1(@v, 30001);
CALL sp1(@v, 30002);
SELECT @v;
DROP PROCEDURE sp1;
DELIMITER /;
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;
/
DELIMITER ;/
SET @v=10;
CALL sp1(@v, 30001);
SELECT @v;
SET @v=10;
--error 30002
CALL sp1(@v, 30002);
SELECT @v;
DROP PROCEDURE sp1;