我有以下触发代码,但给我错误。我无法弄清楚我的代码出了什么问题。
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;
答案 0 :(得分:0)
尝试一下:
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 ;