> -----Original Message----- > From: Walton Hoops [mailto:wal...@vyper.hopto.org] > Hi all. > I am running into a very frustrating problem trying to created a stored > procedure. > > I had originally assumed I was using bad syntax, but even examples > copied > and pasted > > directly from the manual are giving the same error. > mysql> CREATE DEFINER = 'walton'@'localhost' PROCEDURE account_count() > > -> BEGIN > > -> SELECT 'Number of accounts:', COUNT(*) FROM mysql.user; > > 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 '' at line 3 > > mysql> > This example can be found at: > > http://dev.mysql.com/doc/refman/5.1/en/create-procedure.html >
Figures, I find the answer just as soon as I send the request for help. I just needed to read the documentation better. As penance, here is the answer I found: >From http://dev.mysql.com/doc/refman/5.1/en/stored-programs-defining.html: "If you use the mysql client program to define a stored program that contains the semicolon characters within its definition, a problem arises. By default, mysql itself recognizes semicolon as a statement delimiter, so you must redefine the delimiter temporarily to cause mysql to pass the entire stored program definition to the server." So the example I was using becomes: DELIMITER | CREATE DEFINER = 'admin'@'localhost' PROCEDURE account_count() SQL SECURITY INVOKER BEGIN SELECT 'Number of accounts:', COUNT(*) FROM mysql.user; END| DELIMITER ; Sorry for the unnecessary question. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/mysql?unsub=arch...@jab.org