Stored Procedures

Stored procedures are a method for encapsulating SQL and logic on the database server. There are many advantages to placing routines on the server, including access to large server resources, minimizing network communication, reuse of code, and security. Placing frequently used code in a stored procedure can also make it easier to develop applications because much of the logic might already be coded.

Three steps are required to get a stored procedure to work:

  • Create the server-side stored procedure.
  • Define the stored procedure to the database.
  • Create the application program that will use the stored procedure.

Each step is outlined in the following sections.

Creating a Stored Procedure

Writing a stored procedure is no different ...

Get Apache Derby—Off to the Races: Includes Details of IBM® Cloudscape™ 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.