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

delimiter support?

ah posted 8 years ago in General
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 ...
ansgar posted 8 years ago
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?
ah posted 8 years ago
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 '{}').
Kirktis posted 8 years ago
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.
ansgar posted 7 years ago
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

MikeSchinkel posted 7 years ago
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.