mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +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:
@ -377,3 +377,31 @@ BEGIN NOT ATOMIC
|
||||
END
|
||||
/
|
||||
DELIMITER ;/
|
||||
|
||||
|
||||
--echo # Testing exceptions
|
||||
|
||||
CREATE TABLE t1 (c1 INT);
|
||||
|
||||
DELIMITER /;
|
||||
|
||||
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;
|
||||
/
|
||||
|
||||
DELIMITER ;/
|
||||
|
||||
CALL sp1('abc', @a);
|
||||
SELECT @a;
|
||||
|
||||
DROP PROCEDURE sp1;
|
||||
DROP TABLE t1;
|
||||
|
Reference in New Issue
Block a user