Components of an SQL procedure
SQL procedures have the following major components: parameters, local variable declarations, and procedure body.
Parameters are values that are passed into, or out of, a procedure. You declare the parameters of the procedure when you create the procedure, and you specify what values are passed as parameters when you run the procedure. The name of the variable that contains a parameter is called a formal parameter, while the value of the parameter when the procedure is run is called an actual parameter.
The values that you pass to the procedure must be of the same data type as in the parameter declaration.
You can also create local variables for use within the procedure to hold and change temporary values in the body of the procedure. Local variables and values are always discarded when the procedure exits. For example, you can create an integer counter as a local variable.
The body of a procedure contains a set of statements that tests conditions and manipulates data in the database.