Using a Stored Procedure
Go Up to Working with Stored Procedures
How a stored procedure is used in a Delphi application depends on how the stored procedure was coded, whether and how it returns data, the specific database server used, or a combination of these factors.
In general terms, to access a stored procedure on a server, an application must:
- 1. Instantiate a
TIBStoredProccomponent and optionally associate it with a stored procedure on the server. Or instantiate a
TIBQuerycomponent and compose the contents of its
SQLproperty to perform either a
SELECTquery against the stored procedure or an
EXECUTEcommand, depending on whether the stored procedure returns a result set. For more information about creating a
TIBStoredProc, see Creating a Stored Procedure Component. For more information about creating a
TIBQuerycomponent, see Working with Queries.
- 2. Provide input parameter values to the stored procedure component, if necessary. When a stored procedure component is not associated with stored procedure on a server, you must provide additional input parameter information, such as parameter names and data types. For more information about providing input parameter information, see Setting Parameter Information at Design Time.
- 3. Execute the stored procedure.
- 4. Process any result and output parameters. As with any other dataset component, you can also examine the result dataset returned from the server. For more information about output and result parameters, see Using Output Parameters and Using the Result Parameter. For information about viewing records in a dataset, see Using Stored Procedures that Return Result Sets.
- Creating a Stored Procedure Component
- Creating a Stored Procedure
- Preparing and Executing a Stored Procedure
- Using Stored Procedures that Return Result Sets
- Using Stored Procedures that Return Data Using Parameters
- Using Stored Procedures that Perform Actions on Data