创建Mysql存储过程出错,请高手指点一下,本人初学Mysql。
错误一:
mysql> create procedure simpleproce1 ()
->begin
->select * from jn;
->end
->//
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 '->begin
->select * from jn;
->end
->' at line 2
后来网上查资料改成这样也还是提示创建失败。
mysql> delimiter //mysql>
mysql> CREATE PROCEDURE simpleproc ()
-> begin
-> select * from jn;
-> end;
-> //
1307 - Failed to CREATE PROCEDURE simpleproc
错误一:
mysql> create procedure simpleproce1 ()
->begin
->select * from jn;
->end
->//
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 '->begin
->select * from jn;
->end
->' at line 2
后来网上查资料改成这样也还是提示创建失败。
mysql> delimiter //mysql>
mysql> CREATE PROCEDURE simpleproc ()
-> begin
-> select * from jn;
-> end;
-> //
1307 - Failed to CREATE PROCEDURE simpleproc
mysql> CREATE PROCEDURE simpleproc ()
-> begin
-> select * from jn;
-> end;
-> //
Query OK, 0 rows affected (0.00 sec)mysql> delimiter ;
mysql>
提供一下
select versioin();
show grants;的信息。
输入你提供的命令显示如下信息,还有权限如何设置,我是用Navicat8ForMysql,我在管理用户里把这个数据库的那些权限都选择√起来了。
mysql> select versioin();
ERROR 1305 : FUNCTION testdata.versioin does not exist
mysql> show grants;
+----------------------------------------------------------------------------------------------------------------------------------------+
| Grants for root@localhost |
+----------------------------------------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD '*3AE212F935ACF1604624270303BE8B9B732909C9' WITH GRANT OPTION |
| GRANT ALL PRIVILEGES ON `testdata`.* TO 'root'@'localhost' WITH GRANT OPTION |
+----------------------------------------------------------------------------------------------------------------------------------------+
2 rows in setmysql> delimiter //
mysql> CREATE PROCEDURE simpleproc ()
-> begin
-> select * from jn;
-> end;
-> //
ERROR 1303 : Can't create a PROCEDURE from within another stored routine
mysql>
我用的是整全的环境APMServ 5.2.0(带的是MySQL 5.0.27),APMServ 5.2.6(带的是MySQL 5.1.28)