Bug #50116 Can't Create Stored Procedure
Submitted: 6 Jan 2010 20:23 Modified: 27 Jan 2010 12:54
Reporter: Joel Caballero Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Workbench: SQL Editor Severity:S3 (Non-critical)
Version:5.2.11 OS:MacOS (Mac OS X (10.6.1))
Assigned to: Assigned Account CPU Architecture:Any
Tags: stored procedure

[6 Jan 2010 20:23] Joel Caballero
Description:
I simply can't create a stored procedure ( routine )

How to repeat:
I right-click on Routines in the Schemata view.  Click on Create Routine...

At that point I replace the name for one that I want.

Click 'Apply'.

This is the SQL Statement...

;
USE db_dev$$
CREATE PROCEDURE `db_dev`.`new_routine` ()
BEGIN

END;

Click 'Apply Changes'.

I get an error.

This is what is in the logs....

ERROR 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 'CREATE PROCEDURE `db_dev`.`new_routine` ()
BEGIN

END' at line 2
SQL Statement:
USE db_dev$$
CREATE PROCEDURE `db_dev`.`new_routine` ()
BEGIN

END

Suggested fix:
Not sure, but I saw this problem on the windows version.  Seemed to be fixed when I went back and edited the routine again.
[14 Jan 2010 9:51] Susanne Ebrecht
In your procedure you write:

END;

semicolon ... but $$ is expected here.

Is your problem related to the fact that the syntax just is wrong and it needs to be:

END$$
[18 Jan 2010 19:30] Joel Caballero
The syntax is wrong, but it's not mine, I believe it's the template that workbench starts off with.
[19 Jan 2010 12:48] Susanne Ebrecht
That didn't answer my question.

Will you get same error by using correct syntax?
[21 Jan 2010 19:32] Joel Caballero
Just tested and it did work, however, I had to add '$$' to the end of 'DELIMITER' too.

I guess it's not a bug, just counter intuitive?
[22 Jan 2010 11:47] Susanne Ebrecht
You guessed right.

I just looked into Workbench 5.2.14 if routines will get closed correct and they will get closed correct.

So there is no bug here at all.
[22 Jan 2010 15:14] Alfredo Kojima
This is a bug, the // DELIMITERs are being replaced with ; on Apply, which should not happen.
[27 Jan 2010 12:54] Alfredo Kojima
This is actually a duplicate of bug #49710