MySQL 函数使用提供的变量抛出错误
MySQL Function use provided variables throws error
我想创建一个函数来计算点之间的距离。
计算按预期进行,但我收到错误消息:
DROP FUNCTION IF EXISTS CalculateDistance;
CREATE FUNCTION CalculateDistance(breite double, laenge double) RETURNS INT READS SQL DATA
BEGIN
DECLARE breite DOUBLE;
SET @ibk_laenge = breite;
CREATE FUNCTION CalculateDistance(breite double, laenge double) RETURNS INT READS SQL DATA
BEGIN
DECLARE breite DOUBLE
MySQL meldet: Dokumentation
1064 - You have an error in your SQL syntax; check the manual that >corresponds to your MySQL server version for the right syntax to use near '' at line 5
这有什么问题吗?
您需要先更改分隔符:
delimiter //
CREATE FUNCTION CalculateDistance ...
END //
delimiter ;
否则函数定义在第一个 ;
处停止,这会使它不完整。
我想创建一个函数来计算点之间的距离。
计算按预期进行,但我收到错误消息:
DROP FUNCTION IF EXISTS CalculateDistance;
CREATE FUNCTION CalculateDistance(breite double, laenge double) RETURNS INT READS SQL DATA
BEGIN
DECLARE breite DOUBLE;
SET @ibk_laenge = breite;
CREATE FUNCTION CalculateDistance(breite double, laenge double) RETURNS INT READS SQL DATA
BEGIN
DECLARE breite DOUBLE
MySQL meldet: Dokumentation 1064 - You have an error in your SQL syntax; check the manual that >corresponds to your MySQL server version for the right syntax to use near '' at line 5
这有什么问题吗?
您需要先更改分隔符:
delimiter //
CREATE FUNCTION CalculateDistance ...
END //
delimiter ;
否则函数定义在第一个 ;
处停止,这会使它不完整。