Re: Function problem - Mailing list pgsql-novice

From Stephan Szabo
Subject Re: Function problem
Date
Msg-id 20070409072749.M4827@megazone.bigpanda.com
Whole thread Raw
In response to Function problem  ("Oscar Chavarria" <cyberbuzzard@gmail.com>)
List pgsql-novice
On Mon, 9 Apr 2007, Oscar Chavarria wrote:

> I would appreciate and thank in advance any help to understand the error
> message I receive when I try to run this function. The function is initially
> accepted with no errors of syntax.
>
>
> CREATE OR REPLACE FUNCTION returns_todate(integer)
>
> RETURNS numeric AS
>
> $BODY$
>
> DECLARE
>
> yield_rows investments%rowtype;
>
> counter integer;
>
> sum_returns numeric;
>
> BEGIN
>
> FOR yield_rows IN SELECT * FROM investments
>
> LOOP
>
> sum_returns:=
> investments.return1+investments.return2+investments.return3+
> investments.return4+investments.return5+investments.return6+
> investments.return7
> ;

My guess is that these should probably be yield_rows.<whatever> since
yield_rows is the variable name rather than using the table name.

pgsql-novice by date:

Previous
From: "Oscar Chavarria"
Date:
Subject: Function problem
Next
From: Tom Lane
Date:
Subject: Re: Function problem