distal-attribute
distal-attribute
distal-attribute
distal-attribute

delimiter support?

User, date Message
Written by ah
7 years ago
Category: General
2 posts since Thu, 29 Mar 07
hi,

first of all, great improvements in RC4 :D

my problem: i want to create a stored procedure like in:

-----------------------------------------------

USE ...;

DROP TABLE IF EXISTS foo;
CREATE TEMPORARY TABLE IF NOT EXISTS foo (...);

DROP PROCEDURE IF EXISTS bar;
DELIMITER '/';
CREATE PROCEDURE bar (...)
BEGIN
...
END/
DELIMITER ';'/

CALL bar(...);

SELECT * FROM foo;

-----------------------------------------------

but when executed then an error message concerning the syntax of "delimiter" pops up. is there a chance that delimiter will be supported? i know that someone asked about this in january 2007, but there was no answer to his or her post ...
Written by ansgar
7 years ago
4936 posts since Fri, 07 Apr 06
I didn't know this command DELIMITER yet. What's the goal of its use? I assume the semicolon is always good isn't it?
Written by ah
7 years ago
2 posts since Thu, 29 Mar 07
it's needed to define stored procedures:

DELIMITER '/';
CREATE PROCEDURE bar (...)
BEGIN
DO CLEVER STUFF;
DO MORE CLEVER STUFF
DO EVEN MORE CLEVER STUFF;
END/
DELIMITER ';'/

if there was no way to change the delimiter then the CREATE PROCEDURE command would be ended after the first ';' (and the execution would break with syntax error).

by changing the delimiter one is able to use the ';' as delimiter inside the procedure definition and at the same time end the CREATE PROCEDURE command with the previously set delimiter '/' (END/). after the procedure definition the delimiter is changed back to ';' so the stored procedure can be executed.

sadly there is no way to 'box' the BEGIN ... END block (like for example with '[]', '""' or '{}').
Written by Kirktis
7 years ago
8 posts since Fri, 09 Mar 07
Strangely, I was just coming on today to post a request for this functionality. It would definitely be better then switching to command line (or another client) when I need this.
Written by ansgar
7 years ago
4936 posts since Fri, 07 Apr 06
ah: Revision 674 has a button which switches the default delimiter to // instead of ; so you can use that whithin these statements.

http://svn.sourceforge.net/heidisql/?rev=674&view=rev
Written by MikeSchinkel
7 years ago
13 posts since Sat, 11 Aug 07
Will the installer be updated any time soon to incorporate this?

Also, why not make it so that the "delimiter" command was just supported?
 

Please login to leave a reply, or register at first.