store procedure, how to get return value
Posted: 09.05.2010, 02:56
How to get a return value from a stored procedure using the component tzreadonlyquery?
........
sp.ParamByName('turno').AsInteger := 0;
sp.ParamByName('fehora').AsString := 'x';
sp.ParamByName('codusuario').AsInteger := 99;
........
sp.ExecSQL;
the store procedure is:
create or alter procedure ADD_MOV (
ICODCLIENTE integer,
DFECHA date,
CTIPOPAGO char(1),
DIMPEX decimal(14,2),
DIMPMIN decimal(14,2),
DIMPMAX decimal(14,2),
ICODMOZO integer,
IMESA integer,
ICODTARJETA integer,
INROTALON integer,
ITURNO integer,
CFEHORA varchar(17),
ICODUSUARIO integer)
returns (
CSERIE char(1),
ICOMPROB integer)
as
begin
select a.serieb, a.boletas from numeros a into :cserie, :icomprob;
update numeros set boletas = boletas + 1;
insert into movimcli (codcliente, fecha, serie, comprob, tipopago, impex, impmin, impmax, codmozo, mesa, codtarjeta, nrotalon, turno, fehora, codusuario) values (:icodcliente, :dfecha, :cserie, :icomprob, :ctipopago, :dimpex, :dimpmin, :dimpmax, :icodmozo, :imesa, :icodtarjeta, :inrotalon, :iturno, :cfehora, :icodusuario);
end
y need the values of :cserie y :icomprob.
In the component, the params serie and comprob are the 13 and 14.
The :
cSerie:= spAgregarMovimcli.Params[13].AsString;
nComprob:= spAgregarMovimcli.Params[14].AsInteger;
not return any value
Can I help me? very thanks!!
(I have Lazarus 0.9.29 r23650 FPC 2.5.1 i386-win32-win32/win64 and Zeos 7.0.0dev of svn)
........
sp.ParamByName('turno').AsInteger := 0;
sp.ParamByName('fehora').AsString := 'x';
sp.ParamByName('codusuario').AsInteger := 99;
........
sp.ExecSQL;
the store procedure is:
create or alter procedure ADD_MOV (
ICODCLIENTE integer,
DFECHA date,
CTIPOPAGO char(1),
DIMPEX decimal(14,2),
DIMPMIN decimal(14,2),
DIMPMAX decimal(14,2),
ICODMOZO integer,
IMESA integer,
ICODTARJETA integer,
INROTALON integer,
ITURNO integer,
CFEHORA varchar(17),
ICODUSUARIO integer)
returns (
CSERIE char(1),
ICOMPROB integer)
as
begin
select a.serieb, a.boletas from numeros a into :cserie, :icomprob;
update numeros set boletas = boletas + 1;
insert into movimcli (codcliente, fecha, serie, comprob, tipopago, impex, impmin, impmax, codmozo, mesa, codtarjeta, nrotalon, turno, fehora, codusuario) values (:icodcliente, :dfecha, :cserie, :icomprob, :ctipopago, :dimpex, :dimpmin, :dimpmax, :icodmozo, :imesa, :icodtarjeta, :inrotalon, :iturno, :cfehora, :icodusuario);
end
y need the values of :cserie y :icomprob.
In the component, the params serie and comprob are the 13 and 14.
The :
cSerie:= spAgregarMovimcli.Params[13].AsString;
nComprob:= spAgregarMovimcli.Params[14].AsInteger;
not return any value
Can I help me? very thanks!!
(I have Lazarus 0.9.29 r23650 FPC 2.5.1 i386-win32-win32/win64 and Zeos 7.0.0dev of svn)