2009-12-28 52 views
0

我只是想創造我的第一個MySQL的存儲過程,我想一些例子幾乎直接從文檔中複製,但它不工作:MySQL 5.0中的存儲過程語法

mysql> delimiter // 
mysql> CREATE PROCEDURE ghost.test (OUT param1 INT) INSERT into admins SELECT COUNT(*) FROM bans; END// 
ERROR 1064 (42000): 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 '; END' at line 1 

什麼這裏的交易?這幾乎是相同的:

mysql> delimiter // 

mysql> CREATE PROCEDURE simpleproc (OUT param1 INT) 
    -> BEGIN 
    -> SELECT COUNT(*) INTO param1 FROM t; 
    -> END// 
Query OK, 0 rows affected (0.00 sec) 

http://dev.mysql.com/doc/refman/5.1/en/create-procedure.html

回答

6

你好像錯過了BEGIN