Subject Re: [ib-support] Stored Procedure error
Author Nando Dessena
Arnaldo,

> CREATE PROCEDURE DIFFERENZA_PAGAMENTO_CLIENTE (
> NORDINE INTEGER)
> AS
> declare variable totaleordine numeric( 18,2 );
> declare variable progressivo numeric( 18,2 );
> declare variable importo numeric( 18,2 );
> declare variable vmycode integer;
>
> begin
> /* find the total amount of the payment */
> select totale from ordiniclienti where mycode= :nordine
> into :totaleordine;
> progressivo = 0; /* reset progressive counter */
> /* sum the various import of the payment */
> for select mycode, importo from pagamenticliente where
> collordine = :nordine order by datapagamento
> into :vmycode, :importo do begin
> /* increment progressive counter */
> progressivo = :totaleordine - ( :progressivo + :importo ) ;
> /* write data on database */
> update pagamenticliente set differenza = :progressivo where mycode
> = :vmycode ; /**** here give me a stack error and lost the connection.
> end /* for ... */
> end

you are probably calling the stored procedure from a trigger on
pagamenticliente, directly or indireclt, thus causing an endless loop.
Ciao
--
____
_/\/ando