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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.