MySQL Forums
Forum List  »  Stored Procedures

Re: Cant get this simple SP to work!!!
Posted by: Beat Vontobel
Date: January 10, 2006 05:13AM

Hi Aaran,

the problem is the delimiter character ';'. If you execute this statement on the MySQL command line, the parser thinks, the whole "CREATE PROCEDURE" statement ends at the first occurence of a ';' (at the end of the "INSERT") and never sees the matching "END" to the "BEGIN".

The solution is to change the delimiter before you issue a "CREATE PROCEDURE" by using something like:

mysql> delimiter //

Then replace the ';' after the "END" with the new delimiter '//'. Now MySQL will treat everything up to the '//' as one statement. Don't forget to change the delimiter back again to ';'.

If you only want to create such a very simple procedure with only one statement, there's another possibility: Just leave out the "BEGIN - END" block around the single statement. Then there is only one semicolon at the end and you won't have to change the delimiter.

Regards,
Beat

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Cant get this simple SP to work!!!
1346
January 10, 2006 05:13AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.