日期:2014-05-16  浏览次数:20703 次

mysql 触发器的新手问题.
表tab3 如果ID大于5,自动改为5,
Create table tab3(id int not null);
Create trigger inser_update_a
Before insert or update on tab3
FOR each ROW 
AS BEGIN 
IF tab3.id >5
then tab3.id= 5
end if
end ;
 上面有错吗, 我运行不出来,报错:
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 'or update on tab3
FOR each ROW 
AS BEGIN 
IF tab3.id >5
then tab3.id= 5
end if
e' at line 2


请问各位是怎么回事呢..

------解决方案--------------------
AS BEGIN

MySQL官方文档 http://dev.mysql.com/doc/refman/5.1/zh/index.html
二楼的时候已经贴过一次文档的地址了。为什么不看一下手册中的语法说明和例子?