Re: Function problem - Mailing list pgsql-general

From brian
Subject Re: Function problem
Date
Msg-id 47BF01E8.5060301@zijn-digital.com
Whole thread Raw
In response to Function problem  (Enrico <scotty@linuxtime.it>)
List pgsql-general
Enrico wrote:
> Hi all,
> I have this piece of code
>
>
> DECLARE
>   minv my_inv;
>   r record;
>   totale numeric(20,5);
>   valore numeric(20,5);
> BEGIN
>
> [.........]
>
>   totale := 0;
>   for r in select * from tminv loop
>      [.........]
>     valore := r.prezzo*r.giacenza;
>     totale := totale+valore;
>     minv.totale = totale;
>     return next minv;
>   end loop;
>   return;
> [......]
>
> So
> the first record has valore=98 and totale=0 for the first time of
> the loop, but my first result of totale is -298 instead of +98.
>

minv.totale := totale;

pgsql-general by date:

Previous
From: Erik Jones
Date:
Subject: Re: Understanding ps -ef "command" column
Next
From: "blackwater dev"
Date:
Subject: joining on concatonation?