Switch to: V10V9V8V7V6V5

BEGIN ... END Compound statement Syntax

Syntax

BEGIN
    [statement_list]
END

Description

BEGIN … END syntax is used for writing compound statements, which can appear within stored routines and triggers. A compound statement can contain multiple statements, enclosed by the BEGIN and END keywords.

statement_list represents a list of one or more statements. Each statement within statement_list must be terminated by a semicolon (;) statement delimiter. Note that statement_list is optional, which means that the empty compound statement (BEGIN END) is legal.

Examples

CREATE PROCEDURE sp1( IN inValue long )
BEGIN
    SET inValue = inValue + 1;
    INSERT INTO t1(f1) VALUES( inValue );
END