tags:

views:

212

answers:

3

DELIMITER //

What is the of use of it?

+7  A: 

It changes the statement delimiter from ; to //. This is so you can write ; in your trigger definition without the MySQL client misinterpreting that as meaning you're done with it.

Note that when changing back, it's DELIMITER ;, not DELIMITER; as I've seen people try to do.

chaos
+2  A: 

In SQL you close each statement with a delimiter, which is by default a semicolon (;). In a trigger you need to write multiple statements, each ending in a semicolon. To tell MySQL that those semicolons are not the end of your trigger statement, you temporarily change the delimiter from ; to //, so MySQL will know that the trigger statement only ends when it econunters a //.

Zed
A: 

Read the (ummmm) mysql documentation.

delimiter is the marker for the end of each command you send to the mysql command line client.

delimiter is not only related to triggers, but defining triggers and stored procedures is one strong use case as you wish them to contain semicolons (;) which are otherwise the default delimiter.

Sorin Mocanu