gpt4 book ai didi

mysql - 存储过程mysql workbench中缺少分号错误

转载 作者:行者123 更新时间:2023-11-29 05:09:13 25 4
gpt4 key购买 nike

嗨,我是 mysql 的新手,正在尝试通过存储过程更新表。我收到“缺少分号错误。我尝试了一切,但我无法理解为什么会这样。

程序:

DROP PROCEDURE IF EXISTS abc;
use smartdata;
DELIMITER $$

CREATE PROCEDURE abc(IN datasourceId int)
begin

update DM_Sample_Search_Param_Disposition_Type set DM_Sample_Search_Param_Disposition_Type.Active = 0
From DM_Sample_Search_Param_Disposition_Type dm_ss_param_cl
left join DM_Sample_Search_Param dm_ss_param on dm_ss_param_cl.DM_Sample_Search_Param_id =dm_ss_param.DM_Sample_Search_Param_id
left join DM_Sample_Store dm_ss on dm_ss.DM_Sample_Store_Id=dm_ss_param.DM_Sample_Store_Id
where dm_ss.Datasource_Id=datasourceId;

end $$
DELIMITER //

靠近下一行的错误:

set DM_Sample_Search_Param_Disposition_Type.Active = 0

表中“Active”是tinyint。请帮忙

最佳答案

MySQL 使用与 MSSQL 不同的更新语法:update ... join .. set ... where ...

update DM_Sample_Search_Param_Disposition_Type dm_ss_param_cl
left join DM_Sample_Search_Param dm_ss_param on dm_ss_param_cl.DM_Sample_Search_Param_id =dm_ss_param.DM_Sample_Search_Param_id
left join DM_Sample_Store dm_ss on dm_ss.DM_Sample_Store_Id=dm_ss_param.DM_Sample_Store_Id
set DM_Sample_Search_Param_Disposition_Type.Active = 0
where dm_ss.Datasource_Id=datasourceId;

关于mysql - 存储过程mysql workbench中缺少分号错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42483876/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com