Overview of Stored Procedures
Go Up to Working with Stored Procedures
A stored procedure is a self-contained program written in InterBase procedure and trigger language, and stored as part of a the database metadata.
Once you have created a stored procedure, you can invoke it directly from an application, or substitute the procedure for a table or view in a SELECT statement. Stored procedures can receive input parameters from and return values to applications.
InterBase procedure and trigger language includes SQL data manipulation statements and some powerful extensions, including
IF … THEN
… ELSE, WHILE … DO,
FOR SELECT … DO, exceptions, and error handling.
The advantages of using stored procedures include:
- Modular design:
- Applications that access the same database can share stored procedures, eliminating duplicate code and reducing the size of the 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 re-link them; applications are compiled and optimized only once for each client.
- Improved performance:
- Stored procedures are executed by the server, not the client, which reduces network traffic, and improves performance, especially for remote client access.