我需要为一个名为try ..的表创建一个触发器,它会在输入到表中之后执行..(我使用的是phpmyadmin mysql)
但我在创建它时遇到#1064
错误。
我的触发器包含
BEGIN
DECLARE aa decimal(4,3);
DECLARE bb decimal(4,3);
DECLARE cc decimal(4,3);
DECLARE cur1 CURSOR FOR SELECT a,b,c FROM site;
OPEN cur1;
FETCH NEXT FROM cur1 into aa,bb,cc;
WHILE FETCH_STATUS=0 DO
PRINT aa;
END WHILE;
END
它显示像这样的错误
MySQL said: #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 'aa; END WHILE; END' at line 9
我是新手触发......帮助我......谢谢
答案 0 :(得分:0)
尝试将while循环更改为
WHILE FETCH_STATUS=0 DO
//print here
END WHILE;
如此链接中所述
http://dev.mysql.com/doc/refman/5.7/en/while.html
另外请参阅有关mysql打印功能的这篇文章