首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > Mysql >

mysql 触发器的新手有关问题

2012-03-26 
mysql 触发器的新手问题.表tab3 如果ID大于5,自动改为5,Create table tab3(id int not null)Create trigg

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

热点排行