我正在尝试创建存储过程,但我遇到了问题。
delimiter |
create procedure get_user_credits_2(guid char(50))
BEGIN
SELECT user_credits.GUID,
creditwarninglevel,
creditsexpirydate,
EmailCreditWarningLevel,
EmailAddressWarningLevel,
CustomerName,
CASE WHEN user_credits.Credits > 0
THEN sum(user_credits.Credits) + SUM(user_credits.PurchasedCredits)
ELSE user_credits.Credits
END AS 'Credits'
FROM
user_credits
WHERE guid=iguid;
END
|
delimiter ;
Error 1064: You have an error in your SQL syntax, check the manual to your mysql server version for the right syntax to use near 'END' at line 15.
我查了几个来源,但我无法解决这个问题。我确定这可能是我一直在寻找的东西。感谢
我已在此处检查了另一个问题来源:MYSQL stored procedure, case
图像:
答案 0 :(得分:2)
我解决了这个问题,由于某种原因,Navitcat IDE不喜欢你声明一个程序并以
开头的事实BEGIN
END
它只关心select语句。例如
Select * from table;