我在下面的存儲過程Error Code: 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 'DECLARE CONTINUE HANDLER FOR NOT FOUND SET done=1; OPEN cur1; count' at line 13
錯誤1064在存儲過程中
DELIMITER $$
DROP PROCEDURE IF EXISTS cursor_example
$$
CREATE PROCEDURE cursor_example()
READS SQL DATA
BEGIN
DECLARE i_Name CHAR(3);
DECLARE i_SurfaceArea FLOAT(10,2);
DECLARE done INT DEFAULT 0;
DECLARE cur1 CURSOR FOR
SELECT Name, SurfaceArea
FROM country
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done=1;
OPEN cur1;
country_loop:LOOP
FETCH cur1 INTO i_Name, i_SurfaceArea;
IF done=1 THEN
LEAVE country_loop;
END IF;
END LOOP country_loop;
CLOSE cur1;
END;
$$
DELIMITER ;
得到這個錯誤,只是一般的整個過程是如何想的工作,什麼是它。 謝謝。
「正確的錯誤」是什麼意思? – EJP