Stored Procedure Param Size issue with DescribeParams
Posted: Fri 29 Apr 2016 20:22
I have an issue with the use of StoredProcs, running this code:
The 'EXAMPLE_STORED_PROC' is defined in my firebird DB and expecting 2 input parameters of type Integer. I need to be able to pass the 2nd parameter as String as shown in the code. The problem is that if I send first a string '1' and then, on a subsequent call with the same StoredProc Object I send '4321' the parameter is truncated to '4'.
Can someone tell me what's happening?
Code: Select all
function TForm7.CallStoredProc(param1: integer; param2: string): string;
var IBCStoredProc2: TIBCStoredProc;
begin
IBCStoredProc1.Connection := IBCConnection1;
IBCStoredProc1.Options.DescribeParams := true;
IBCStoredProc1.StoredProcName := 'EXAMPLE_STORED_PROC';
IBCStoredProc1.Prepare;
IBCStoredProc1.Params[0].AsInteger := param1;
IBCStoredProc1.Params[1].AsString := param2;
IBCStoredProc1.Transaction.Active := True;
IBCStoredProc1.ExecProc;
IBCStoredProc1.Transaction.Commit;
Result := IBCStoredProc1.Params[2].AsString;
end;Can someone tell me what's happening?