DROP PROCEDURE IF EXISTS procedure_one;
CREATE PROCEDURE procedure_one ()
BEGIN
DECLARE idx varchar(255);
DECLARE lat double;
DECLARE lng double;
DECLARE zoom int;
DECLARE exit_loop BOOLEAN;
DECLARE cur1 CURSOR FOR select pokestop_id, latitude, longitude, 4 from pokestop;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET exit_loop = TRUE;
OPEN cur1;
read_loop: LOOP
FETCH cur1 INTO idx, lat, lng, zoom;
IF exit_loop THEN
LEAVE read_loop;
END IF;
CALL pokemonmap.location_definer_2(idx, lat, lng, zoom);
END LOOP;
CLOSE cur1;
END;
-----------------------------------------------------------------------------------------------------------------------------------
DROP PROCEDURE IF EXISTS procedure_two;
CREATE PROCEDURE procedure_two(
IN idx varchar(255),
IN lat double,
IN lng double,
IN zoom int
)
BEGIN
DECLARE scale int(3);
DECLARE worldx float;
DECLARE worldy float;
DECLARE siny float;
DECLARE tilex int;
DECLARE tiley int;
DECLARE tileindex int;
SET scale = zoom;
SET siny = sin(lat * 3.1415926 / 180);
SET siny = min( max(siny, -0.9999), 0.9999);
SET worldx = 256 * (0.5 + lng / 360);
SET worldy = 256 * (0.5 - log((1 + siny) / (1 - siny)) / (4 * 3.1415926));
SET tilex = floor(worldx * scale / 256);
SET tiley = floor(worldy * scale / 256);
SET tileindex = tilex * tiley;
update pokestop_test set zoom4 = tileindex where pokestop_id = idx;
END;
--------------------------------------------------------------------------------------------------------------------------------
위의 procedure_one 에서 procedure_two 를 불러오는 구조로 만들고 있는데 procedure_one 은 compile 잘 되었는데
procedure_two는 컴파일에서 오류가 나네요
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 ' -0.9999), 0.9999);
SET worldx = 256 * (0.5 + lng / 360);
SET worldy =' at line 25
고수님들 도와주세요 ㅠㅠ