gpt4 book ai didi

mysql - 我的 mysql 触发器代码存在语法错误。错误 1064 (42000) :

转载 作者:行者123 更新时间:2023-11-29 16:10:09 27 4
gpt4 key购买 nike

我有以下触发代码,但它给了我错误。我无法弄清楚我的代码出了什么问题。

    DROP TRIGGER IF EXISTS `user_has_voice_queues_rt_update`;
CREATE DEFINER=`root`@`localhost`
TRIGGER `user_has_voice_queues_rt_update`
BEFORE UPDATE ON `user_has_voice_queues_rt`
FOR EACH ROW begin
if(new.pause='0') then
Set new.penalty = (select max(penalty) from user_has_voice_queues_rt) + 1;
end if;

最佳答案

试试这个:

DROP TRIGGER IF EXISTS `user_has_voice_queues_rt_update`;
DELIMITER $$

CREATE DEFINER=`root`@`localhost`
TRIGGER `user_has_voice_queues_rt_update`
BEFORE UPDATE ON `user_has_voice_queues_rt`
FOR EACH ROW begin
if(new.pause='0') then
Set new.penalty = (select max(penalty) from user_has_voice_queues_rt) + 1;
end if;

END $$
DELIMITER ;

关于mysql - 我的 mysql 触发器代码存在语法错误。错误 1064 (42000) :,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55331500/

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