Using Input Parameters
Go Up to Understanding Stored Procedure Parameters
Application use input parameters to pass singleton data values to a stored procedure. Such values are then used in SQL statements within the stored procedure, such as a comparison value for a WHERE
clause. If a stored procedure requires an input parameter, assign a value to the parameter prior to executing the stored procedure.
If a stored procedure returns a dataset and is used through aSELECT
query in a TIBQuery
component, supply input parameter values as a comma-separated list, enclosed in parentheses, following the stored procedure name. For example, the SQL statement below retrieves data from a stored procedure named GET_EMP_PROJ
and supplies an input parameter value of 52.
SELECT PROJ_ID FROM GET_EMP_PROJ(52)
If a stored procedure is executed with a TIBStoredProc
component, use the Params
property or the ParamByName
method access to set each input parameter. Use the TParam
property appropriate for the data type of the parameter, such as the TParam.AsString
property for a CHAR type parameter. Set input parameter values prior to executing or activating the TIBStoredProc
component. In the example below, the EMP_NO parameter (type SMALLINT
) for the stored procedure GET_EMP_PROJ
is assigned the value 52.
with IBStoredProc1 do begin ParamByName(‘EMP_NO’).AsSmallInt := 52; ExecProc; end;