Understanding Stored Routines

A stored procedure is a series of SQL statements stored in a MySQL database. For a frequently executed series of commands, this is a time-saving feature—you only need to execute the stored procedure.

A stored function is a stored routine that can return a value to SQL. A useful feature is the capability to define libraries of functions so that you can perform an operation on your database from any client program. Libraries of commonly used functions and procedures help reduce code duplication and make your systems easier to maintain.

Function Libraries

If you use multiple APIs to communicate with your database, you ...

Get Sams Teach Yourself MySQL now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.