Using Stored Procedures

From InterBase

Go Up to Working with Stored Procedures

Stored procedures can be used in applications in a variety of ways. Select procedures are used in place of a table or view in a SELECT statement. Executable procedures are used with an EXECUTE PROCEDURE statement.

Both kinds of procedures are defined with CREATE PROCEDURE and have the same syntax. The difference is in how the procedure is written and how it is intended to be used. Select procedures always return one or more rows, so that to the calling program they appear as a table or view. Executable procedures are simply routines invoked by the calling program and only optionally return values.

In fact, a single procedure can be used as a select procedure or an executable procedure, but this is not recommended. A procedure should be written specifically to be used in a SELECT statement (a select procedure) or to be used in an ­EXECUTE PROCEDURE statement (an executable procedure).

During application development, create and test stored procedures in isql. Once a stored procedure has been created, tested, and refined, it can be used in applications. For more information on using stored procedures in applications, see the Embedded SQL Guide.


Advance To: