使用MySql Workbench更新存储过程中的语句 [英] Update Statement in Stored Procedure using MySql Workbench
问题描述
大家好,
我正在尝试使用存储过程对我的表记录执行更新功能,但显然,我的脚本似乎没有工作。其中,我怀疑所使用的SET命令是在Update函数中,而在存储过程中使用的SET命令是''碰撞''。如果我错了,请纠正我。
请参考如何在存储过程中完成更新功能。
这是我的存储过程版本:
CREATE PROCEDURE mysql_biosys.edit_Site(site_Id_Parsed INT,site_Name_Entered VARCHAR(64),address_Entered VARCHAR(64),postal_code_Entered INT,
starts_Date_Entered VARCHAR(16),completion_Date_Entered VARCHAR(16))
BEGIN
UPDATE site >
SET site_Name = site_Name_Entered,
address = address_Entered,
postal_Code = postal_code_Entered,
starts_Date = starts_Date_Entered,
completion_Date = completion_Date_Entered
WHERE site_Id = site_Id_Parsed;
END;
|
提前谢谢。
Hi all,
I am trying to use Stored Procedure to do an Update function to my table records, but apparently, my script doesn''t seem to work. In which, I suspect that the SET command used is in Update function and the SET command used in Stored Procedure sort of ''clashes''. Correct me if I am wrong.
Please advice on how to get the Update function done in Stored Procedure.
Here''s my version of Stored Procedure:
CREATE PROCEDURE mysql_biosys.edit_Site(site_Id_Parsed INT, site_Name_Entered VARCHAR(64), address_Entered VARCHAR(64), postal_code_Entered INT,
commence_Date_Entered VARCHAR(16), completion_Date_Entered VARCHAR(16))
BEGIN
UPDATE site
SET site_Name = site_Name_Entered,
address = address_Entered,
postal_Code = postal_code_Entered,
commence_Date = commence_Date_Entered,
completion_Date = completion_Date_Entered
WHERE site_Id = site_Id_Parsed;
END;
|
Thanks in advance.
推荐答案
我们应该指定参数的类型(In,Out,InOut传递给存储过程。
We should specify the type of parameter(In,Out,InOut) passing to stored procedure.
这篇关于使用MySql Workbench更新存储过程中的语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!