在before UPDATE中 set @ee=0; select count(*) into @ee from itbarcode where new.a_barcode=barcode or new.b_barcode=barcode; if @ee>=1 then set new.a_barcode=old.a_barcode; set new.b_barcode=old.b_barcode; end if
create trigger test before update on barcode for each row begin set @ee=0; select count(*) into @ee from itbarcode where new.a_barcode=barcode or new.b_barcode=barcode; if @ee>=1 then set new.a_barcode=old.a_barcode; set new.b_barcode=old.b_barcode; end if end; 错误提示: 执行错误 # 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 'end' at line 9怎么我贴的图 看不到呢 就我看的到?
set @ee=0;
select count(*) into @ee from itbarcode where new.a_barcode=barcode or new.b_barcode=barcode;
if @ee>=1 then
set new.a_barcode=old.a_barcode;
set new.b_barcode=old.b_barcode;
end if
MySQL 中如何在触发器里中断记录的插入或更新?
for each row begin
set @ee=0;
select count(*) into @ee from itbarcode where new.a_barcode=barcode or new.b_barcode=barcode;
if @ee>=1 then
set new.a_barcode=old.a_barcode;
set new.b_barcode=old.b_barcode;
end if
end;
错误提示: 执行错误 # 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
'end' at line 9怎么我贴的图 看不到呢 就我看的到?