MySQueaL Resources

resources for mysql admins and developers who are squealing for help

More Resources

Main Doc Pages
Comments
MySQL columns: everywhere I look are tables and columns; life is filled with databases of information to be ordered and grouped. (Ca'Grande, Milan, Italy)

BEGIN...END Statement

Use this combination of MySQL statements to start and end the steps that are part of a stored procedure or trigger.

hits past month: 18 ;  last updated: may 4, 2009 - 2:34am ;  parent: MySQL Stored Routines

Syntax

BEGIN...END

Explanation

Use this combination of statements to start and end the steps that are part of a stored procedure or trigger. In essence, BEGIN marks the beginning of a compound SQL statement and END marks the end of it. Multiple SQL statements can be included between them.

Traditionally, as you know from using the mysql client, each SQL statement must end with a semi-colon. However, semi-colons must be used within CREATE PROCEDURE and CREATE TRIGGER statements to separate the internal statements that form the procedure or trigger. In order not to confuse the parser in the client and server, include a DELIMITER command to change the default delimiter to another character before entering BEGIN and then to set it back to a semi-colon again after entering END. For an example of these statements, see the examples for CREATE PROCEDURE and CREATE TRIGGER.

There are no examples for this page of our documentation. Return to MySQL Stored Routines page of our MySQL Documentation