MDEV-10411 Providing compatibility for basic PL/SQL constructs

Part 10: Default variable value: x INT := 10;
This commit is contained in:
Alexander Barkov 2016-08-11 15:47:17 +04:00
parent 8fdc1f0147
commit 0c9c4b84b7
3 changed files with 32 additions and 0 deletions

View file

@ -1,4 +1,19 @@
SET sql_mode=ORACLE;
# Testing ":=" to set the default value of a variable
CREATE FUNCTION f1 () RETURNS NUMBER(10) AS
a NUMBER(10) := 10;
BEGIN
DECLARE
b NUMBER(10) DEFAULT 3;
BEGIN
RETURN a+b;
END;
END;
/
SELECT f1();
f1()
13
DROP FUNCTION f1;
# Testing labels
CREATE FUNCTION f1 (a INT) RETURNS CLOB AS
BEGIN

View file

@ -1,5 +1,21 @@
SET sql_mode=ORACLE;
--echo # Testing ":=" to set the default value of a variable
DELIMITER /;
CREATE FUNCTION f1 () RETURNS NUMBER(10) AS
a NUMBER(10) := 10;
BEGIN
DECLARE
b NUMBER(10) DEFAULT 3;
BEGIN
RETURN a+b;
END;
END;
/
DELIMITER ;/
SELECT f1();
DROP FUNCTION f1;
--echo # Testing labels
DELIMITER /;

View file

@ -2851,6 +2851,7 @@ sp_decl_idents:
sp_opt_default:
/* Empty */ { $$ = NULL; }
| DEFAULT expr { $$ = $2; }
| SET_VAR expr { $$ = $2; }
;
/*