Can create procedure without using delimiter in MySQL?

Viewed 1027

I have a question about creating stored procedure in MySql without using delimiter I search a lot in web but i dont find anything usefull for finding my answer. so can we ever dont use delimiter?? if yes, how? I am so happy if anyone can help me here with this question thank you

1 Answers

If the procedure is just a single statement, you don't need to change the delimiter.

CREATE PROCEDURE myProc(param INT)
SELECT col1, col2 FROM someTable WHERE col3 = param;

You only have to change the delimiter if the procedure consists of multiple statements, since ; is the statement terminator in the procedure. If you don't change the delimiter, it will be treated as the terminator of the CREATE PROCEDURE statement itself.

Related