mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
MDEV-10411 Providing compatibility for basic PL/SQL constructs
Part 10: Default variable value: x INT := 10;
This commit is contained in:
parent
8fdc1f0147
commit
0c9c4b84b7
3 changed files with 32 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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 /;
|
||||
|
|
|
@ -2851,6 +2851,7 @@ sp_decl_idents:
|
|||
sp_opt_default:
|
||||
/* Empty */ { $$ = NULL; }
|
||||
| DEFAULT expr { $$ = $2; }
|
||||
| SET_VAR expr { $$ = $2; }
|
||||
;
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue