zengyangzhiit
itjava2017
2017-07-12 09:40

mysql触发器insert一直不被执行

  • mysql
  • 触发器
 DROP TRIGGER t_afterinsert_on_tab1 ;
CREATE TRIGGER t_afterinsert_on_tab1 
AFTER insert ON a
for each row 
BEGIN

if exists(select count(*) from a where a.tag_id=new.tag_id) THEN 
     update testhuanzhuanglie set value=new.temperature where name=new.tag_id;
else
        insert into testhuanzhuanglie(NAME,value) values(new.tag_id,new.temperature);
end if;
END
  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

3条回答

为你推荐

换一换