这个存储过程有什么问题?

2021-12-20 00:00:00 mysql stored-procedures

我不断收到以下 MySQL SP 的错误有什么想法吗?

I keep getting this error for the below MySQL SP any ideas?

CREATE PROCEDURE productpricing(
OUT pl DECIMAL(8,2), OUT phDECIMAL(8,2), OUT pa DECIMAL(8,2) )BEGIN SELECT Min(amount) INTO pl从卡错误代码:1064 你有一个SQL 语法错误;检查与您的 MySQL 相对应的手册正确语法的服务器版本在第 9 行 '' 附近使用 0.000 秒

CREATE PROCEDURE productpricing(
OUT pl DECIMAL(8,2), OUT ph DECIMAL(8,2), OUT pa DECIMAL(8,2) ) BEGIN SELECT Min(amount) INTO pl FROM Card 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 '' at line 9 0.000 sec

DROP PROCEDURE IF EXISTS productpricing;
CREATE PROCEDURE productpricing(
   OUT pl DECIMAL(8,2),
   OUT ph DECIMAL(8,2),
   OUT pa DECIMAL(8,2)
)
BEGIN
   SELECT Min(amount)
   INTO pl
   FROM Card;
END;

推荐答案

您是否定义了分隔符?

尝试在 CREATE PROCEDURE 语句之前添加 delimiter//.同时将 END; 替换为 END;//.我检查过,它对我有用.

Try adding delimiter // before the CREATE PROCEDURE statement. Also replace END; with END;//. I checked and it works for me.

请参阅有关存储过程的 MySQL 文档

相关文章