Table of Contents [+/-]
This chapter discusses stored programs and views, which are database objects defined in terms of SQL code that is stored on the server for later invocation.
Stored programs include these objects:
Stored routines, that is, stored procedures and functions. A
stored function is used much like a built-in function. you
invoke it in an expression and it returns a value during
expression evaluation. A stored procedure is invoked using the
CALL
statement. A procedure does
not have a return value but can modify its parameters for later
inspection by the caller. It can also generate result sets to be
returned to the client program.
Triggers. A trigger is a named database object that is associated with a table and that is activated when a particular event occurs for the table, such as an insert or update.
Views are stored queries that when invoked produce a result set. A view acts as a virtual table.
This chapter describes how to use each type of stored program and views. Additional information about SQL syntax for statements related to these objects is available in the following locations:
For each object type, there are CREATE
,
ALTER
, and DROP
statements
that control which objects exist and how they are defined. See
Section 12.1, “Data Definition Statements”.
The CALL
statement is used to
invoke stored procedures. See Section 12.2.1, “CALL
Syntax”.
Stored program definitions contain a body that may use compound statements, loops, conditionals, and declared variables. See Section 12.7, “MySQL Compound-Statement Syntax”.
User Comments
Add your own comment.