Database Reference
In-Depth Information
Note
The
IF
Statement This example showed the basic use of the MariaDB
IF
statement.
IF
also supports
ELSEIF
and
ELSE
clauses (the former also uses a
THEN
clause;
the latter does not). We see additional uses of
IF
(as well as other flow control state-
ments) in future chapters.
To display the
CREATE
statement used to create a stored procedure, use the
SHOW CREATE PROCEDURE
statement:
▼
Input
SHOW CREATE PROCEDURE ordertotal;
To obtain a list of stored procedures including details on when and who cre-
ated them, use
SHOW PROCEDURE STATUS
.
Tip
Limiting Procedure Status Results
SHOW PROCEDURE STATUS
lists all stored pro-
cedures. To restrict the output you can use
LIKE
to specify a filter pattern, for example:
SHOW PROCEDURE STATUS LIKE 'ordertotal';
In this chapter, you learned what stored procedures are and why they are used.
You also learned the basics of stored procedure execution and creation syntax,
and you saw some of the ways these can be used. We continue this subject in
the next chapter.