views:

125

answers:

1

I'm just trying to create my first mysql stored procedure and I'm trying to copy some examples almost directly from the documentation, but it isn't working:

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

What is the deal here? This is almost identical to:

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)

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

+4  A: 

Looks like you're missed the BEGIN.

Andomar