23

Working with Stored Procedures

In this chapter, you’ll learn what stored procedures are, why they are used, and how they are used. You’ll also learn the basic syntax for creating and using them.

Understanding Stored Procedures

Note

This Chapter Requires MySQL 5 Support for stored procedures was added to MySQL 5. Therefore, this chapter is applicable to MySQL 5 or later only.

Most of the SQL statements that we’ve used thus far are simple in that they use a single statement against one or more tables. Not all operations are that simple, though. Often, multiple statements are needed to perform a complete operation. For example, consider the following scenario:

  • To process an order, checks must be made to ensure that items are in stock.

Get MySQL Crash Course, 2nd Edition 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.