Chapter 11. Stored Procedures

A stored procedure is something that is both stored (that is, it's a database object) and procedural (that is, it can contain constructs like IF, WHILE, BEGIN/END). Like a procedure in any language, an SQL stored procedure can accept parameters, declare and set variables, and return scalar values. A stored procedure may contain one or more SQL statements, including SELECT, so it can return result sets too. Listing 11-1 shows an example of a stored procedure declaration, in SQL Standard syntax.

Portability

MySQL does not support stored procedures. All gains shown in this chapter are for only seven DBMSs. Also, because stored procedures were around long before the SQL Standard got around to requiring them, every DBMS ...

Get SQL Performance Tuning 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.