On 6-12-2016 17:57, 'Israel Pinheiro' [email protected] 
[firebird-support] wrote:
>
>
> Error in procedure. Please!

Please include the full error in the body of your message; don't use the 
subject to communicate pertinent information (especially not if it seems 
to be incomplete).

Also do you get this error when altering the procedure or executing the 
procedure?

> ALTER PROCEDURE EQPRODUTOSP01 (ICODEMP INTEGER,
>
> SCODFILIAL SMALLINT,
>
> ICODPROD INTEGER,
>
> ICODEMPAX INTEGER,
>
> SCODFILIALAX SMALLINT,
>
> ICODALMOX INTEGER,
>
> DTPESQ DATE)
>
> RETURNS (NSALDO NUMERIC(15, 5),
>
> NSALDOAX NUMERIC(15, 5),
>
> NCUSTOMPM NUMERIC(15, 5),
>
> NCUSTOPEPS NUMERIC(15, 5),
>
> NCUSTOMPMAX NUMERIC(15, 5),
>
> NCUSTOPEPSAX NUMERIC(15, 5),
>
> NCUSTOINFO NUMERIC(15, 5),
>
> NCUSTOUC NUMERIC(15, 5))
>
> AS
>
> declare variable ddtmovprod date;
>
> declare variable ddtmovprodax date;
>
> begin
>
>
>
>         if (:dtpesq is null) then
>
>         begin
>
>            dtpesq = cast('now' as date);
>
>         end
>
>     /* Procedure que retorna saldos e custos para a tela de cadastro de
> produtos */
>
>     select first 1 mp.dtmovprod, mp.sldmovprod , mp.custompmmovprod
>
>     from eqmovprod mp
>
>     where mp.codemppd=:icodemp and mp.codfilialpd=:scodfilial and
> mp.codprod=:icodprod
>
>     and mp.dtmovprod<=:dtpesq
>
>     order by mp.dtmovprod desc, mp.codmovprod desc
>
>     into :ddtmovprod, :nsaldo, :ncustompm;
>
>
>
>     select first 1 mp.dtmovprod, mp.sldmovprodax, mp.custompmmovprodax
>
>     from eqmovprod mp
>
>     where mp.codemppd=:icodemp and mp.codfilialpd=:scodfilial and
> mp.codprod=:icodprod
>
>     and mp.dtmovprod<=:dtpesq
>
>     order by mp.dtmovprod desc, mp.codmovprod desc
>
>     into :ddtmovprodax, :nsaldoax, :ncustompmax;
>
>
>
>     select p.ncustopeps  from eqcalcpepssp(:icodemp, :scodfilial,
>
>     :icodprod, :nsaldo, :ddtmovprod, null, null, null ) p
>
>     into :ncustopeps;
>
>
>
>     select p.ncustopeps  from eqcalcpepssp(:icodemp, :scodfilial,
>
>     :icodprod, :nsaldo, :ddtmovprodax, :icodempax, :scodfilialax,
>
>     :icodalmox ) p
>
>     into :ncustopepsax;
>
>
>
>     select p.custoinfoprod from eqproduto p
>
>     where p.codemp=:icodemp and p.codfilial=:scodfilial and
> p.codprod=:icodprod
>
>     into :ncustoinfo;
>
>
>
>     select custounit from eqcustoprodsp(:icodemp, :scodfilial, :icodprod,
>
>     :dtpesq,'U',:icodempax, :scodfilialax, :icodalmox, 'N' )
>
>     into :ncustouc;
>
>
>
>     if(:ncustompm is null) then
>
>     begin
>
>         ncustompm = :ncustoinfo;
>
>     end
>
>
>
>     if(:ncustopeps is null) then
>
>     begin
>
>         ncustopeps = :ncustoinfo;
>
>     end
>
>
>
>     suspend;
>
>
>
> end

-- 
Mark Rotteveel

Reply via email to