Mysql stored Procedure DELIMITER // DELIMITER $$

what is the difference between


DELIMITER //
and
DELIMITER $$
LVL 8
kingjelyAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Query Syntax

From novice to tech pro — start learning today.