Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Not a Bug
-
10.1.38
-
None
Description
In a stored function, RETURN can't be used right after BEGIN.
For example, this fails:
DELIMITER //
|
|
CREATE FUNCTION trust_me(x INT)
|
RETURNS INT
|
DETERMINISTIC
|
READS SQL DATA
|
BEGIN
|
RETURN (x) //
|
END //
|
|
DELIMITER ;
|
With the non-sensical "empty string" error message:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 6
|
https://mariadb.com/kb/en/library/basic-sql-debugging/#interpreting-the-empty-error
But it works just fine if you remove the BEGIN/END. For example:
CREATE FUNCTION trust_me(x INT)
|
RETURNS INT
|
DETERMINISTIC
|
READS SQL DATA
|
RETURN (x);
|