读书人

mysql 触发器的新手有关问题

发布时间: 2012-03-26 15:46:56 作者: rapoo

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
二楼的时候已经贴过一次文档的地址了。为什么不看一下手册中的语法说明和例子?

读书人网 >Mysql

热点推荐