Subject Re: [IBO] Parameter mismatch
Author Helen Borrie
Christian:

Some things that come to mind:
1. SQL.Add('EXECUTE PROCEDURE P_Berechtigungscheck'); - this call does not
pass the input parameter. It should be

EXECUTE PROCEDURE P_Berechtigungscheck(:p_Stufe)

2. If you have AutoDefineParams set True, you need to set it to false.
3. SetColumnValue doesn't seem to be a Method of the Params array of
TIB_StoredProc. Have you tried this by using ParamByName instead?
4. I don't understand why you are clearing the SQL property of the Stored
Proc each time it is called.
5. I believe you should test the IB_StoredProc for Prepared state and make
it false before calling prepare,
i.e.

with sp_Check_Rechte do
begin
if Prepared then
Prepared := False;
//// remove ////SQL.Clear;
//// remove ////SQL.Add('EXECUTE PROCEDURE P_Berechtigungscheck');
Prepare;
ParamByName('p_Stufe').AsString := 'Controlling Stufe 1';
ExecProc;
end;

Helen
-----------------------------------------------------------
At 01:31 AM 22-12-00 +0100, you wrote:
>Hi,
>
>am am using a TIB_StoredProc to execute a procedure
>which retrieves a value.
>When I execute the procedure for the first time, it works.
>But when I execute it the second time, an error occurs:
>
>ISC ERROR CODE 335544569
>Dynamic SQL Error
>parameter mismatch for procedure p_Berechtigungscheck
>
>
>The delphi code is the following:
>
> with sp_Check_Rechte do
> begin
> SQL.Clear;
> SQL.Add('EXECUTE PROCEDURE P_Berechtigungscheck');
> Prepare;
> Params.SetColumnValue('p_Stufe', 'Controlling Stufe 1');
> ExecProc;
> end;
>
>This is the code of the stored proc in the database:
>
>ALTER PROCEDURE "P_BERECHTIGUNGSCHECK"
>(
> P_STUFE VARCHAR(20)
>)
>RETURNS
>(
> ERGEBNIS INTEGER
>)
>AS
>
>DECLARE VARIABLE v_Benutzer VARCHAR(10);
>DECLARE VARIABLE v_Stufe VARCHAR(20);
>BEGIN
> SELECT Benutzer, Stufe FROM T_Berechtigungen WHERE ((Benutzer=USER) and
>(Stufe=:p_Stufe)) INTO :v_Benutzer, v_Stufe;
>if (v_Benutzer = USER) THEN
>BEGIN
> Ergebnis = 0;
>END
>ELSE
>BEGIN
> Ergebnis=1;
>END
>SUSPEND;
>END
> ^
>
>
>Can anybody tell me why this error occurs?
>
>
>TIA,
>Christian
>
>
>
>

All for Open and Open for All
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________