22,207
社区成员
发帖
与我相关
我的任务
分享
drop table if EXISTS test;
create table test(
id int not null primary key,
weight int not null
);
DELIMITER $
drop trigger if exists tri_test_U
$
create trigger tri_test_U after insert
on test for each row
begin
declare v int;
if new.weight<0 then
set v = 1/0;
end if;
end$
DELIMITER ;
insert into test values(1,2);
insert into test values(2,-1);
select * from test;