Working with Stored Procedures (Embedded SQL Guide)

From InterBase

Go Up to Embedded SQL Guide


A stored procedure is a self-contained set of extended SQL statements stored in a database as part of its metadata.

Applications can interact with stored procedures in the following ways:

  • They can pass parameters to and receive return values from stored procedures.
  • They can invoke stored procedures directly to perform a task.
  • They can substitute an appropriate stored procedure for a table or view in a SELECT statement.

The advantages of using stored procedures are:

  • Applications can share code. A common piece of SQL code written once and stored in the database can be used in any application that accesses the database, including the new InterBase interactive SQL tool, isql.
  • Modular design. Stored procedures can be shared among applications, eliminating duplicate code, and reducing the size of applications.
  • Streamlined maintenance. When a procedure is updated, the changes are automatically reflected in all applications that use it without the need to recompile and relink them.
  • Improved performance, especially for remote client access. Stored procedures are executed by the server, not the client.

This chapter describes how to call and execute stored procedures in applications once they are written. For information on how to create a stored procedure, see the Data Definition Guide.

Topics

Advance To: