Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can create procedure without using delimiter in MySQL?

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

like image 704
Mohammad Kiyan Avatar asked Oct 27 '25 00:10

Mohammad Kiyan


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.

like image 164
Barmar Avatar answered Oct 29 '25 14:10

Barmar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!