Using compound statements

A compound statement starts with the keyword BEGIN and ends with the keyword END. The body of a procedure is a compound statement. Compound statements can also be used in batches. Compound statements can be nested, and combined with other control statements to define execution flow in procedures or in batches.

A compound statement allows a set of SQL statements to be grouped together and treated as a unit. SQL statements within a compound statement should be separated with semicolons.

A command delimiter is required after every statement in a statement list except for the last, where it is optional.