You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
create trigger t4
before
insert
on ord
for each row
begin
declare has_num int;
select good_num into has_num from good where good_id = new.good_id;
if has_num < new.ord_num then
set new.ord_num = has_num;
end if;
update good set good_num =0 where good_id = new.good_id;
end$
你写错sql了 给数字加单引号
给数字加上单引号~
您好,我是有问必答小助手,您的问题已经有小伙伴解答了,您看下是否解决,可以追评进行沟通哦~
如果有您比较满意的答案 / 帮您提供解决思路的答案,可以点击【采纳】按钮,给回答的小伙伴一些鼓励哦~~
ps:问答VIP仅需29元,即可享受5次/月 有问必答服务,了解详情>>>https://vip.csdn.net/askvip?utm_source=1146287632