Conclusion

In this chapter we reviewed the facilities MySQL provides for including SQL within stored programs. The following types of SQL statements can appear in stored programs:

SQL statements can also be prepared dynamically using MySQL server-side prepared statements.

If your SQL statements generate an error, your stored program will terminate and return control to the calling program unless you create an error handler that "catches" the error and takes appropriate action. We saw a simple example of an error handler in this chapter and looked at NOT FOUND handlers that handle the end of a cursor result set. In the next chapter we'll cover the topic of error handlers in greater detail.

Категории