SQL procedures are defined using the CREATE PROCEDURE statement. The statement defines the name, the parameters, and several other properties of the procedure.
The SQL procedure logic is defined in the procedure body of the CREATE PROCEDURE statement. The body is typically a compound statement consisting of declarations followed by procedural statements. The DECLARE statement is used to declare variables, their data type, and optionally, a default value. Statements such as SET, SELECT...INTO, and VALUES can also be used to assign values to variables.
This chapter demonstrated creation of simple procedures with some basic procedural statements. Other SQL PL statements will be discussed in detail in the rest of this book.