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

- Adding exception handler syntax:
  WHEN exception_name THEN statement
- Adding EXCEPTION section intoi the top BEGIN..END SP block.
  Note, currently EXCEPTION goes in the beginning of the top BEGIN..END
  SP block.

TODO:
- add EXCEPTION section into inner blocks
- move EXCEPTION to the end of the block
This commit is contained in:
Alexander Barkov
2016-08-11 14:12:14 +04:00
parent a44e90ae05
commit 8fdc1f0147
5 changed files with 83 additions and 1 deletions

View File

@ -350,3 +350,23 @@ i
4
i
3
# Testing exceptions
CREATE TABLE t1 (c1 INT);
CREATE PROCEDURE sp1 (p1 IN VARCHAR2(20), p2 OUT VARCHAR2(30))
IS
v1 INT;
BEGIN
EXCEPTION WHEN NOT FOUND THEN
BEGIN
p2 := 'def';
END;
SELECT c1 INTO v1 FROM t1;
p2 := p1;
END;
/
CALL sp1('abc', @a);
SELECT @a;
@a
def
DROP PROCEDURE sp1;
DROP TABLE t1;