Toad World® Forums

[MySQL] delimiter

How to generate DDL script (for mysql) which contains common objects (tables) and stored procedures/triggers? SPs/TRGs requires special syntax - changing delimiter to another one.
In common it looks like this:

DELIMITER $$

CREATE PROCEDURE sp_shortdocs(id INTEGER UNSIGNED)
BEGIN

some;
statements;

END $$

DELIMITER ;

Is it possible to achieve it automatically? Fixing script manually is not what I want to do daily.

Currently, I have to change delimiter during script generating but it affects whole generated script.

By the way one more think I reported a year ago (valid for all dbs)
Please generate default delimiter (semicolon) in the line of the statement. Adding it a line bellow makes script quite unreadable.

Hi Michal,

at present there is no fully automatic way to achieve this.

You did it probably the same way:

  1. To Before script, write: DELIMETER $$
  2. To After script, write: DELIMETER;
  3. In DDL Script Generation, set terminator to: $$

The result is the same like yours.

I have created CR 88067 to automate the process.

And as to the semicolon after statement on separate line:
The reason in this is that some dbs require to have some delimiters on separate line and therefore we decided to use delimiters on single lines. In fact I think it makes the script more readable as it makes an empty line after each statement.

Regards,
Lukas

thanx.
Tip with before/after script does the job