Commit 915c5df8 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-12088 sql_mode=ORACLE: Do not require BEGIN..END in multi-statement...

MDEV-12088 sql_mode=ORACLE: Do not require BEGIN..END in multi-statement exception handlers in THEN clause
parent 99df09ec
......@@ -381,3 +381,29 @@ DROP FUNCTION f1;
#
# End of MDEV-10587 sql_mode=ORACLE: User defined exceptions
#
#
# MDEV-12088 sql_mode=ORACLE: Do not require BEGIN..END in multi-statement exception handlers in THEN clause
#
CREATE TABLE t1 (a INT PRIMARY KEY);
INSERT INTO t1 VALUES (10),(20),(30);
CREATE PROCEDURE p1(a INT) AS
BEGIN
INSERT INTO t1 (a) VALUES (a);
EXCEPTION
WHEN DUP_VAL_ON_INDEX THEN
a:= a+1;
INSERT INTO t1 VALUES (a);
WHEN OTHERS THEN
NULL;
NULL;
END;
$$
CALL p1(30);
SELECT * FROM t1;
a
10
20
30
31
DROP PROCEDURE p1;
DROP TABLE t1;
......@@ -431,3 +431,27 @@ DROP FUNCTION f1;
--echo #
--echo # End of MDEV-10587 sql_mode=ORACLE: User defined exceptions
--echo #
--echo #
--echo # MDEV-12088 sql_mode=ORACLE: Do not require BEGIN..END in multi-statement exception handlers in THEN clause
--echo #
CREATE TABLE t1 (a INT PRIMARY KEY);
INSERT INTO t1 VALUES (10),(20),(30);
DELIMITER $$;
CREATE PROCEDURE p1(a INT) AS
BEGIN
INSERT INTO t1 (a) VALUES (a);
EXCEPTION
WHEN DUP_VAL_ON_INDEX THEN
a:= a+1;
INSERT INTO t1 VALUES (a);
WHEN OTHERS THEN
NULL;
NULL;
END;
$$
DELIMITER ;$$
CALL p1(30);
SELECT * FROM t1;
DROP PROCEDURE p1;
DROP TABLE t1;
......@@ -3734,8 +3734,8 @@ opt_exception_clause:
;
exception_handlers:
exception_handler ';' { $$= 1; }
| exception_handlers exception_handler ';' { $$= $1 + 1; }
exception_handler { $$= 1; }
| exception_handlers exception_handler { $$= $1 + 1; }
;
exception_handler:
......@@ -3746,7 +3746,7 @@ exception_handler:
}
sp_hcond_list
THEN_SYM
sp_proc_stmt
sp_proc_stmts1_implicit_block
{
if (Lex->sp_handler_declaration_finalize(thd, sp_handler::EXIT))
MYSQL_YYABORT;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment