Define routines containing semicolons.

Section: stored procedures and functions

Change the statement delimiter

sql
sql
DELIMITER $$
CREATE PROCEDURE get_user_by_email(IN p_email VARCHAR(255))
BEGIN
  SELECT id, email, full_name
  FROM users
  WHERE email = p_email;
END $$
DELIMITER ;
Explanation

Changing the delimiter is the standard pattern when creating stored procedures in the mysql client.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing stored procedures and functions
Call a stored procedure
Execute a procedure with input arguments.
OpenIn sheetsqlsame section
Create a scalar function
Return a computed value from SQL code.
OpenIn sheetsqlsame section
List stored procedures
Display procedures visible in a schema.
OpenIn sheetsqlsame section
Show procedure definition
Display the CREATE PROCEDURE statement for an existing routine.
OpenIn sheetsqlsame section
Create a BEFORE INSERT trigger
Normalize row data before insert.
List triggers
Display triggers defined in the current schema.