Subject RE: [IBO] Error executing sp
Author Helen Borrie
At 09:20 PM 5/06/2004 +1000, you wrote:

>Do you mean it retrned no error or no return value? The cursor should return
>the value but you now need to use the SELECT syntax
>SELECT ACCOUNTID FROM USER_SESSION_START2(:ACCOUNTNAME,:USERNAME:PASSWRD);

Alan,
Your comments are quite misleading. It is *not* necessary to make a SP
selectable in order to get the return values.

The SP as originally written, if called via TIB_DSQL with

EXECUTE PROCEDURE USER_SESSION_START2 (:ACCOUNTNAME,:USERNAME,:PASSWRD)

should return the return value (ACCOUNTID) in the Fields array.

I wonder if it is being called correctly.

You must test whether it is prepared, and call the Execute method, not Open.
var
AcctID: integer;
begin

with MySP do
begin
if not IB_Transaction.Started then
IB_Transaction.StartTransaction;
if not Prepared then Prepare;
ParamByName....
ParamByName....
ParamByName....
Execute;
AcctID := Fields[0].AsInteger;
end;
end;

Helen