MySQL DELIMITER statement not working in Squirrel

2,737 views
Skip to first unread message

Philip

unread,
Nov 30, 2011, 4:01:27 PM11/30/11
to Google Cloud SQL discuss
I have the following statements that work fine in MySQLWorkbench:

DROP PROCEDURE IF EXISTS test_delimiter;
DELIMITER //
CREATE PROCEDURE test_delimiter()
BEGIN
END//
DELIMITER ;

When I try to run them in Squirrel, I get:

Error: 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 'DELIMITER //
CREATE PROCEDURE test_delimiter()
BEGIN
END//
DELIMITER' at line 1
SQLState: 42000
ErrorCode: 1064
Error occured in:
DELIMITER //
CREATE PROCEDURE test_delimiter()
BEGIN
END//
DELIMITER

Any ideas why?

Also, it would be great to have Cloud SQL support MySQLWorkbench. Is
there a way to connect the two?

Rob Clevenger

unread,
Nov 30, 2011, 4:06:37 PM11/30/11
to google-cloud...@googlegroups.com
DELIMITER is a command for the client to use to know when to send the sql statement.  Squirrel doesn't know about it.

Sqirrel doesn't send the sql when enter is pressed, so it's not needed, just remove the DELIMITER commands.

Rob

Philip

unread,
Nov 30, 2011, 6:29:08 PM11/30/11
to Google Cloud SQL discuss
OK. But when I try the following:

DROP PROCEDURE IF EXISTS test_delimiter;

CREATE PROCEDURE test_delimiter()
BEGIN
SELECT * FROM my_table;
END;

I get:

Error: 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


SQLState: 42000
ErrorCode: 1064
Error occured in:

CREATE PROCEDURE test_delimiter()
BEGIN
SELECT * FROM my_table

So how do I create a multi SQL statement procedure or function using
Squirrel? Also, it would be nice to have SQL that works in both
MySQLWorkbench and Squirrel.

Rob Clevenger

unread,
Dec 1, 2011, 7:21:29 PM12/1/11
to google-cloud...@googlegroups.com
Where did you try this, in squirrel or the google_sql.sh tool.

in google_sql.sh you need to use DELIMITER like you had originally.  In squirrel, I'm not sure how to do this.

Rob

Giovanni Mascia

unread,
Dec 2, 2011, 6:27:34 AM12/2/11
to google-cloud...@googlegroups.com
Rob: DELIMITER is a proper SQL command that you use to change the char to be used as a delimiter. Since ';' is the default delimiter, one typically changes it to something else i.e. '//' to have the freedom to use ';' in multiline procedures as single-line delimiter (as opposed to // to be used as a procedure delimiter). So it should be understood and properly passed by every mysql client.

Philip: I think you have a syntax error in your example. If you try something classic like this, it should definitely work:

DELIMITER //
CREATE PROCEDURE test_delimiter()
BEGIN
  SELECT * FROM MY_TABLE;
END//
DELIMITER ;

I confess I did try this only in the google_sql tool, but there's no reason why Squirrel should not accept it, since the MySql engine does.

Giovanni Mascia

unread,
Dec 2, 2011, 6:45:49 AM12/2/11
to google-cloud...@googlegroups.com
Apologize - DELIMITER is actually a client thing, so a given client might not support it.

Apparently, to have it supported in Squirrel, you need to enable the so-called "MySql Plugin" - by default, Squirrel is not able to parse procedure statements.

Philip

unread,
Dec 2, 2011, 1:28:35 PM12/2/11
to Google Cloud SQL discuss
Giovanni, you were right.

The "MySQL Plugin" fixes the issue and I can now create functions and
procedures using Squirrel.

The "MySQL Plugin" was tricky to install on OS X. The Squirrel
installer wasn't showing checkmarks as I clicked next to optional
plugins. The first time I would click on an optional plugin, it
wouldn't show as selected (no highlight in blue or checkmark).
Sometimes, the second time I clicked, the checkmark would appear.
After installing Squirrel a few times, I noticed that optional plugins
(with checkmarks) were not being installed. The solution to that was
for me to only click on optional plugins in the installer once and
even though a checkmark did not appear, they apparently were selected
and installed. I was able to see that this worked using the Squirrel
Plugins / Summary menu item.

On Dec 2, 3:45 am, Giovanni Mascia <gmas...@google.com> wrote:
> Apologize - DELIMITER is actually a client thing, so a given client might
> not support it.
>
> Apparently, to have it supported in Squirrel, you need to enable the
> so-called "MySql Plugin" - by default, Squirrel is not able to parse
> procedure statements.
>
>
>
>
>
>
>
> On Fri, Dec 2, 2011 at 12:27 PM, Giovanni Mascia <gmas...@google.com> wrote:
> > Rob: DELIMITER is a proper SQL command that you use to change the char to
> > be used as a delimiter. Since ';' is the default delimiter, one typically
> > changes it to something else i.e. '//' to have the freedom to use ';' in
> > multiline procedures as single-line delimiter (as opposed to // to be used
> > as a procedure delimiter). So it should be understood and properly passed
> > by every mysql client.
>
> > Philip: I think you have a syntax error in your example. If you try
> > something classic like this, it should definitely work:
>
> > DELIMITER //
> > CREATE PROCEDURE test_delimiter()
> > BEGIN
> >   SELECT * FROM MY_TABLE;
> > END//
> > DELIMITER ;
>
> > I confess I did try this only in the google_sql tool, but there's no
> > reason why Squirrel should not accept it, since the MySql engine does.
>

Reply all
Reply to author
Forward
0 new messages