Mysql stored Procedure DELIMITER // DELIMITER $$

what is the difference between


DELIMITER //
and
DELIMITER $$
LVL 8
kingjelyAsked:
Who is Participating?
 
Muhammad KhanManager, ITCommented:
if you use DELIMITER // ...

// must be used as a line separator

if you use DELIMITER $$

$$ must be used as a line separator in your stored procedure..

it is just for the convenience and ease of programmers
0
 
kingjelyAuthor Commented:
as stupid as it sounds, Not sure i understand fully.

i can use either DELIMITER // OR DELIMITER $$
they are the same thing

I only use these at the start and end of a stored procedure to allow multiple semi colins ;

Is that correct.
0
 
theGhost_k8Database ConsultantCommented:
Yes.
DELIMITER command will change delimiter from default ; to // or $$. Let it be $$ or //.

For mysqldoc:
"The example uses the mysql client delimiter command to change the statement delimiter from ; to // while the procedure is being defined. This allows the ; delimiter used in the procedure body to be passed through to the server rather than being interpreted by mysql itself. See Section 19.1, “Defining Stored Programs”.

it is unnecessary to use delimiter because the function definition contains no internal ; statement delimiters..."
http://dev.mysql.com/doc/refman/5.1/en/create-procedure.html
0
Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

 
kingjelyAuthor Commented:

Okay, thanks guys !
0
 
pareshprajapatiCommented:
There is no difference between // or $$. You can even use your own delimiter like %% or ## or any text sequence.

Default delimiter is ;

Mysql uses this to identify that query or procedure or any sql command has been ended.
0
 
kingjelyAuthor Commented:
Ahh Okay thanks pare !

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.