This documentation is for an older version. If you're using the most current version, select the documentation for that version with the version switch in the upper right corner of the online documentation, or by downloading a newer PDF or EPUB file.

Chapter 18 Stored Programs and Views

Table of Contents

18.1 Defining Stored Programs
18.2 Using Stored Routines (Procedures and Functions)
18.2.1 Stored Routine Syntax
18.2.2 Stored Routines and MySQL Privileges
18.2.3 Stored Routine Metadata
18.2.4 Stored Procedures, Functions, Triggers, and LAST_INSERT_ID()
18.3 Using Triggers
18.3.1 Trigger Syntax and Examples
18.3.2 Trigger Metadata
18.4 Using Views
18.4.1 View Syntax
18.4.2 View Processing Algorithms
18.4.3 Updatable and Insertable Views
18.4.4 The View WITH CHECK OPTION Clause
18.4.5 View Metadata
18.5 Access Control for Stored Programs and Views
18.6 Binary Logging of Stored Programs

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 execution.

Stored programs include these objects:

Views are stored queries that when referenced produce a result set. A view acts as a virtual table.

This chapter describes how to use stored programs and views. The following sections provide additional information about SQL syntax for statements related to these objects: