Understanding Stored Procedure Parameters
Go Up to Working with Stored Procedures
There are four types of parameters that can be associated with stored procedures:
- Input parameters, used to pass values to a stored procedure for processing.
- Output parameters, used by a stored procedure to pass return values to an application.
- Input/output parameters, used to pass values to a stored procedure for processing, and used by the stored procedure to pass return values to the application.
- A result parameter, used to return an error or status value to an application. A stored procedure can only return one result parameter.
Whether a stored procedure uses a particular type of parameter depends both on the general language implementation of stored procedures on your database server and on a specific instance of a stored procedure. For example, individual stored procedures on any server may either be implemented using input parameters, or may not be. On the other hand, some uses of parameters are server-specific. For example, the InterBase implementation of a stored procedure never returns a result parameter.
Access to stored procedure parameters is provided by
TParam objects in the
TIBStoredProc.Params property. If the name of the stored procedure is specified at design time in the
StoredProcName property, a
TParam object is automatically created for each parameter and added to the
Params property. If the stored procedure name is not specified until runtime, the
TParam objects need to be programmatically created at that time. Not specifying the stored procedure and manually creating the
TParam objects allows a single
TIBStoredProc component to be used with any number of available stored procedures.
- Using Input Parameters
- Using Output Parameters
- Using Input/output Parameters
- Using the Result Parameter
- Accessing Parameters at Design Time
- Setting Parameter Information at Design Time
- Creating Parameters at Runtime