2 36.4. User-Defined Procedures #
4 A procedure is a database object similar to a function. The key
6 * Procedures are defined with the CREATE PROCEDURE command, not
8 * Procedures do not return a function value; hence CREATE PROCEDURE
9 lacks a RETURNS clause. However, procedures can instead return data
10 to their callers via output parameters.
11 * While a function is called as part of a query or DML command, a
12 procedure is called in isolation using the CALL command.
13 * A procedure can commit or roll back transactions during its
14 execution (then automatically beginning a new transaction), so long
15 as the invoking CALL command is not part of an explicit transaction
16 block. A function cannot do that.
17 * Certain function attributes, such as strictness, don't apply to
18 procedures. Those attributes control how the function is used in a
19 query, which isn't relevant to procedures.
21 The explanations in the following sections about how to define
22 user-defined functions apply to procedures as well, except for the
25 Collectively, functions and procedures are also known as routines.
26 There are commands such as ALTER ROUTINE and DROP ROUTINE that can
27 operate on functions and procedures without having to know which kind
28 it is. Note, however, that there is no CREATE ROUTINE command.