创建存储过程时出现mysql错误 [英] mysql error when creating a stored procedure
本文介绍了创建存储过程时出现mysql错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有人可以告诉我我在此过程中做错了什么吗?
我将不胜感激.它给了我一个语法错误.
can someone tell me what i am doing wrong in this procedure ?
i will appreciate any help. it gives me a syntax error.
CREATE PROCEDURE `bank`.`withdraw` (accountId int, customerId int, amount double)
BEGIN
Declare var_balance double;
Declare var_accountId int;
Declare var_customerId int;
Declare var_remainder double;
select account.accountId, customer.customerId, account.balance into var_accountId, var_customerId, var_balance
from customer, account
where account.accountId = accountId and customer.customerId = customerId;
if amount < var_balance then
set var_remainder = account.balance - amount;
END
推荐答案
if amount < var_balance then
set var_remainder = account.balance - amount;
应该是
should be
if amount < var_balance then
set var_remainder = var_balance - amount;
end if
这篇关于创建存储过程时出现mysql错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文