我试图实现存储过程
DELIMITER $$
CREATE PROCEDURE FindRadius(IN stop_lat float,IN stop_lng float,IN lat float,IN lng float,OUT radius float)
BEGIN
declare R INT DEFAULT 6371;
declare dLat float;
declare dLon float;
declare a float;
declare c float;
dLat = RADIANS(stop_lat-lat);
dLon = RADIANS(stop_lng-lng);
a = SIN(dLat/2) * SIN(dLat/2) +COS(RADIANS(stop_lat)) * COS(RADIANS(lat)) * SIN(dLon/2) *SIN(dLon/2);
c = 2 * ATAN2(SQRT(a),SQRT(1-a));
SET radius = R * c *1000;
END$$
DELIMITER ;
它抛出错误,说您的 SQL 语法有错误;
RADIANS(stop_lat-lat); dLon = RADIANS(stop_lng-lng); a = SIN(dLat/2) * SI' at line 8
我不知道为什么会出现这个错误,谁能帮忙