Subject Re: [IBO] execute procedure problems
Author Manuel Fresneda
Here are de code of the prucedure:

CREATE PROCEDURE POLIZA_POLMOD (
POLPRO INTEGER,
POLCOD INTEGER)
RETURNS (
POLMOD INTEGER)
AS
begin
select polmod from poliza
where polpro = :polpro
and polcod = :polcod
into polmod;
if (polmod is null) then polmod = 0;
suspend;
end

and the trace.

/*---
START TRANSACTION
DB HANDLE COUNT 1
TR_HANDLE = 15547492
----*/
/*---
PREPARE STATEMENT
TR_HANDLE = 15548016
STMT_HANDLE = 15547328

SELECT RDB$PARAMETER_NAME
FROM RDB$PROCEDURE_PARAMETERS
WHERE RDB$PARAMETER_TYPE = ? /* RDB$PARAMETER_TYPE */
AND RDB$PROCEDURE_NAME = ? /* RDB$PROCEDURE_NAME */
ORDER BY RDB$PARAMETER_NUMBER ASC

PLAN SORT ((RDB$PROCEDURE_PARAMETERS INDEX (RDB$INDEX_18)))

FIELDS = [ Version 1 SQLd 1 SQLn 84
RDB$PROCEDURE_PARAMETERS.RDB$PARAMETER_NAME = <NIL> ]

SECONDS = 0,010
----*/
/*---
EXECUTE STATEMENT
TR_HANDLE = 15548016
STMT_HANDLE = 15547328
PARAMS = [ Version 1 SQLd 2 SQLn 2
[RDB$PARAMETER_TYPE] = 0
[RDB$PROCEDURE_NAME] = 'poliza_polmod ' ]
----*/
/*---
EXECUTE STATEMENT
TR_HANDLE = 15548016
STMT_HANDLE = 15547328
PARAMS = [ Version 1 SQLd 2 SQLn 2
[RDB$PARAMETER_TYPE] = 1
[RDB$PROCEDURE_NAME] = 'poliza_polmod ' ]

SECONDS = 0,010
----*/
/*---
PREPARE STATEMENT
TR_HANDLE = 15547492
STMT_HANDLE = 15547536

EXECUTE PROCEDURE poliza_polmod

FIELDS = [ Version 1 SQLd 1 SQLn 84
RDB$PROCEDURE_PARAMETERS.RDB$PARAMETER_NAME = <NIL> ]

ERRCODE = 335544569
----*/
/*---
PREPARE STATEMENT
TR_HANDLE = 15547492
STMT_HANDLE = 15547536

EXECUTE PROCEDURE poliza_polmod

FIELDS = [ Version 1 SQLd 1 SQLn 84
RDB$PROCEDURE_PARAMETERS.RDB$PARAMETER_NAME = <NIL> ]

ERRCODE = 335544569
----*/
/*---
INTERPRETE BUFFER =

ERRCODE = 17
----*/
/*---
INTERPRETE BUFFER = Dynamic SQL Error

ERRCODE = 46
----*/
/*---
INTERPRETE BUFFER = parameter mismatch for procedure POLIZA_POLMOD

ERRCODE = -1
----*/



--- In IBObjects@y..., "Jason Wharton" <jwharton@i...> wrote:
> Please show us the source for the PROC and the SQL trace.
>
> Jason Wharton
> CPS - Mesa AZ
> http://www.ibobjects.com
>
>
> ----- Original Message -----
> From: "Manuel Fresneda" <manuelfresnedaguerra@y...>
> To: <IBObjects@y...>
> Sent: Monday, October 29, 2001 6:51 AM
> Subject: [IBO] execute procedure problems
>
>
> > Hi all.
> >
> > I have the next code:
> >
> > with tDatos.pCalculo do
> > begin
> > Close;
> > SQL.Clear;
> > SQL.Add('execute procedure poliza_polmod :polpro,:polcod');
> > ParamByName('polpro').Value := AEntero(pcaccpro.Text);
> > ParamByName('polcod').Value := AEntero(pcacccod.Text);
> > ExecProc;
> > Modalidad := FieldByName('polmod').AsInteger;
> > end;
> >
> > if the database is in dialect 1 all is right, but if i change it
> > to dialect 3 then i get the following:
> >
> > ISC ERROR CODE:335544569
> > ISC ERROR MESSAGE:
> > Dynamic SQL Error
> > parameter mismatch for procedure POLIZA_POLMOD
> >
> >
> > I use Delphi6+Sp1 IBO_4_2_F IB6
> >
> > Someone knows why.
> >
> > Thanks
> >