MySQL Forums
Forum List  »  Newbie

Re: mysql not recognizing DELIMITER
Posted by: danish hafeez
Date: February 14, 2024 01:21AM

It seems like you're encountering issues with setting the delimiter for creating stored procedures in MySQL. The problem lies in the way you're using the DELIMITER command.

When working with MySQL stored procedures, you typically use the DELIMITER command to change the delimiter temporarily, allowing you to use semicolons (;) within the body of the stored procedure without prematurely ending the statement.

Here's the corrected version of your code:

Copy code
USE employees;
DROP PROCEDURE IF EXISTS select_employees;

CREATE PROCEDURE select_employees()
SELECT * FROM employees LIMIT 1000;
END $$

You first set the delimiter to $$ using DELIMITER $$.
Then you create the stored procedure, and within the procedure definition, you use END $$ to signify the end of the procedure.
Finally, you reset the delimiter back to ; using DELIMITER ;.

Options: ReplyQuote

Written By
Re: mysql not recognizing DELIMITER
February 14, 2024 01:21AM

Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.