Subject Parameter mismatch
Author Christian Gütter
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