Using Output Parameters

From InterBase

Go Up to Understanding Stored Procedure Parameters


Stored procedures use output parameters to pass singleton data values to an application that calls the stored procedure. Output parameters are not assigned values except by the stored procedure and then only after the stored procedure has been executed. Inspect output parameters from an application to retrieve its value after invoking the TIBStoredProc.ExecProc method.

Use the TIBStoredProc.Params property or TIBStoredProc.ParamByName method to reference the TParam object that represents a parameter and inspect its value. For example, to retrieve the value of a parameter and store it into the Text property of a TEdit component:

with IBStoredProc1 do begin
  ExecProc;
  Edit1.Text := Params[0].AsString;
end;

Most stored procedures return one or more output parameters. Output parameters may represent the sole return values for a stored procedure that does not also return a dataset, they may represent one set of values returned by a procedure that also returns a dataset, or they may represent values that have no direct correspondence to an individual record in the dataset returned by the stored procedure. Each server’s implementation of stored procedures differs in this regard.

Advance To: