Reference Guide > TDV SQL Script > SQL Script Procedures and Structure > Compound Statements
 
Compound Statements
A compound statement in SQL Script has multiple statements within a BEGIN-END pair. A compound statement must end with a semicolon if it is not the root statement.
Syntax
[<label>:]
BEGIN
[<transactionSpecification>]
[<declaration>; …]
[<statement>; …]
[<exceptionBlock>]
END [<label>]
Remarks
The label is for use with the LEAVE statement defined in LEAVE.
The label is an optional identifier used to name the block. The root BEGIN statement (the one directly following the PROCEDURE declaration) can have (be preceded by) a label.
When BEGIN is present, END is optional. If BEGIN is not present, it is illegal to have an END label. If both BEGIN and END are present, both must have the same identifier.
A compound statement can be empty.
Example
PROCEDURE init_table()
BEGIN
  DELETE FROM T;
  INSERT INTO T DEFAULT VALUEs;
END