mysql触发器 ERROR 1064 (42000):...the right syntax to use near '' at line...

各位大佬,可以帮我找一下这个错在哪里吗?

代码是:
(一个人只能有一个email(这里暂且认为有一个‘@’,就代表有一个email))

drop trigger if exists insert_email $
create trigger insert_email
before insert on author
for each row
begin
set @one=(select locate(’@’,new.email)); #’@one’是’@‘第一次出现的位置,如果不出现’@’,则@one=0.
set @two=(select locate(’@’,new.email,@one)); #’@two’是’@‘第二次出现的位置,如果有第二个’@'则@two<>0
if (@one=0) then #如果@没有出现
select ‘error,your email does not have “@”’;
insert into error_email values(new.aid,new.email);
set new.email=‘error,please check table “error_email”’;
else if (@two<>0) then #如果有好几个@
select ‘error,an author can only have one email’;
insert into error_email values(new.aid,new.email);
set new.email=‘error,please check table “error_email”’;
end if;
end $

错误提示是:ERROR 1064 (42000): 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 16

谢谢大家!

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值