在存储过程中调用存储过程时出现语法错误

时间:2018-03-11 06:56:39

标签: mysql stored-procedures syntax-error

我正在尝试在另一个存储过程中调用存储过程。

我在main过程调用子过程的语句中遇到语法错误。

这是我的查询

DROP  PROCEDURE GetAllProducts;

DELIMITER //

CREATE PROCEDURE GetAllProducts()
BEGIN

DECLARE finished INT DEFAULT 0; 
DECLARE myName varchar(60);
DEClARE myCursor CURSOR FOR
SELECT Name FROM Test;

DECLARE CONTINUE HANDLER 
FOR NOT FOUND SET finished =1 ;



OPEN myCursor;

get_email: LOOP
FETCH myCursor INTO myName;
IF finished = 1 THEN
 LEAVE get_email;
END IF;

-- Line which shows a syntax error
EXEC UpdateProdcut myName;

END LOOP get_email;




CLOSE myCursor;
DEALLOCATE myCursor;


END //
DELIMITER ;

这是错误消息

ERROR 1064 (42000): 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 'UpdateProdcut myName OUTPUT;

mysql版本是5.5.54

对此有何想法?

感谢。

1 个答案:

答案 0 :(得分:1)

改为使用barcodeList.push(code) var Food = function() { this.image = "noImage.png" this.nutrients = null this.ingredients = null } var foodItems = {} for (var i in barcodeList) { //Some append function var something = new Food() }

CALL

call UpdateProdcut(myName); 用于准备好的陈述。

价: https://dev.mysql.com/doc/refman/5.5/en/call.html