Skip site navigation (1) Skip section navigation (2)

Re: Function problem

From: brian <brian(at)zijn-digital(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Function problem
Date: 2008-02-22 17:10:00
Message-ID: 47BF01E8.5060301@zijn-digital.com (view raw or flat)
Thread:
Lists: 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;

In response to

pgsql-general by date

Next:From: EnricoDate: 2008-02-22 17:19:08
Subject: Re: Function problem
Previous:From: David JaquayDate: 2008-02-22 17:04:53
Subject: Re: Understanding ps -ef "command" column

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group