Creating a simple stored procedure

Stored procedures are database objects that allow us to encapsulate a set of SQL statements and execute them directly on a server. A stored procedure resides in a database server, so when we execute it, it is executed locally. We can implement any business logic or application logic inside a stored procedure and keep it in the database. It can be invoked from any client application. Stored procedures can accept input parameters and return output parameters or result sets or both. In this recipe, we will see how to create a simple stored procedure.

We can define a stored procedure in the following three ways:

  • External procedures: The procedure body is written in a high-level programming language for external procedures ...

Get IBM DB2 9.7 Advanced Application Developer Cookbook 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.