Subject Stored Procedure error
Author apatri@inwind.it
Hi All.

I have the following procedure:

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

In brief i want sum a payment, pay it in 1, 2, 3 or what you want
subpayment.
all works fine, but seems interbase don't update a already select
table.

Please: Any hints??????

TIA
Arnaldo