Using a Stored Procedure

From InterBase

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 TIBStoredProc component and optionally associate it with a stored procedure on the server. Or instantiate a TIBQuery component and compose the contents of its SQL property to perform either a SELECT query against the stored procedure or an EXECUTE command, 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 TIBQuery component, 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.


Advance To: