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

Re: Function problem

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Oscar Chavarria <cyberbuzzard(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Function problem
Date: 2007-04-09 14:32:13
Message-ID: 20070409072749.M4827@megazone.bigpanda.com (view raw or flat)
Thread:
Lists: 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.

In response to

pgsql-novice by date

Next:From: Tom LaneDate: 2007-04-09 15:04:37
Subject: Re: Function problem
Previous:From: Oscar ChavarriaDate: 2007-04-09 14:16:10
Subject: Function problem

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