CREATE DEFINER="root"@"localhost" TRIGGER tbl_dispatch_trigger BEFORE DELETE ON "yxxlogist"."tbl_dispatch" FOR EACH ROW begin delete from tbl_transferrequest where dispatch = OLD.dispatch; delete from tbl_outstorerequest where dispatch = OLD.dispatch; end;
提示了下面的错误
[Err] 1064 – 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 “”yxxlogist”.”tbl_dispatch”
FOR EACH ROW begin
delete from tbl_transferreques” at line 1
各位高手,求指导啊!
解决方案
10
把单引号去掉。
CREATE DEFINER=”root”@”localhost” TRIGGER tbl_dispatch_trigger BEFORE DELETE ON yxxlogist.tbl_dispatch
FOR EACH ROW
begin
delete from tbl_transferrequest where dispatch = OLD.dispatch;
delete from tbl_outstorerequest where dispatch = OLD.dispatch;
end;
CREATE DEFINER=”root”@”localhost” TRIGGER tbl_dispatch_trigger BEFORE DELETE ON yxxlogist.tbl_dispatch
FOR EACH ROW
begin
delete from tbl_transferrequest where dispatch = OLD.dispatch;
delete from tbl_outstorerequest where dispatch = OLD.dispatch;
end;
10
CREATE DEFINER=`root`@`localhost` TRIGGER tbl_dispatch_trigger BEFORE DELETE ON `yxxlogist`.`tbl_dispatch` FOR EACH ROW begin delete from tbl_transferrequest where dispatch = OLD.dispatch; delete from tbl_outstorerequest where dispatch = OLD.dispatch; end;
或把单引号改成反向单引号。
20
单引号不对,要用反单引号
10
这里是不能用单引号的,要用飘号,也就是键盘1左边的那个