Can't update table 'a' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.很清楚,不能再更新A表的时候,在触发器继续更新
解决方案 »
- MYsql 怎么约束列的取值范围
- 如何快速比较两个表相同的记录个数
- 网上说GBK编码不论中、英文字符均使用双字节来表示,那为什么mysql中的“中国ab”返回的长度是6,而不是8
- 如何删除数据库中的乱码的信息
- 关于数据库迁移的初级问题
- phpmyadmin的界面能不能自己改啊?
- 菜鸟问题,我装了mysql 4.0.21后,怎么看不到mysql这个数据库
- 请问如何让Win2000 下的mysql实现自己自动备份。(不用其它软件)
- mysql事务回滚怎样实现
- mysql中文为啥查不出来
- MYSQL5.6启动错误Can't start server: Bind on TCP/IP port: No such file or directory
- mysql存储过程
after insert on a for each row
begin
update a set id=(select b.id from b where b.name=a.name);
end;
MYSQL的触发器中无法对本表自身进行操作,以防递归触发。
错误信息
Error Code: 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 '' at line 5 0.000 sec
那你的语句就应该为
create trigger t_afterinsert_on_tab_abnorrecord
after insert on a for each row
begin
insert into b(id,name) values(new.id,new.name)
end;
你看看这句可以不
create trigger t_afterinsert_on_tab_abnorrecord
after insert on a for each row
begin
update a set id=(select b.id from b where b.name=new.name);
end;