I. Process Control statements
1. Branch structure
If branch:
IF condition 1 Then statement;
ELSEIF condition 2 Then statement;
......
ELSE statement;
END IF;
Case Branch:
case [Condition]
When condition 1 Then statement 1
When condition 2 Then statement 2
......
ELSE Statement N
END case
2. Cyclic structure
Loop loop:
[Begin_label:] LOOP
Statement Group
END LOOP [End_label]
While statement:
[Begin_label:] While condition do
Statement Group
END while [End_label]
REPEAT until statement:
[Begin_label:] REPEAT
Statement Group
UNTIL conditions
END REPEAT [End_label]
Iterate statement: Iterate can only appear within loops, REPEAT, and while statements. Iterate means: "Cycle again." "will return to the label start position again
Iterate label
Leave statement: This statement is used to exit any annotated process control constructs. It and begin ... End or loop is used together. Break as in other languages
LEAVE Label
Ii.. Custom Functions
MySQL database focus: Process Control statements, custom functions, stored procedures, triggers, events, views