From: | "Oscar Chavarria" <cyberbuzzard(at)gmail(dot)com> |
---|---|
To: | pgsql-novice(at)postgresql(dot)org |
Subject: | Function problem |
Date: | 2007-04-09 14:16:10 |
Message-ID: | 716841580704090716g2b19193fm3f4a06c463649067@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
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
;
INSERT INTO investments(returns_to_date) VALUES(sum_returns);
END LOOP;
return counter;
END
$BODY$
LANGUAGE 'plpgsql' VOLATILE;
*SELECT returns_todate(5);*
*ERROR: missing FROM-clause entry for table "investments"*
* *
* *
**_____________________________
Regards
Oscar Chavarria
Mobile: +506 814-0247
From | Date | Subject | |
---|---|---|---|
Next Message | Stephan Szabo | 2007-04-09 14:32:13 | Re: Function problem |
Previous Message | Tom Lane | 2007-04-08 23:16:35 | Re: Odd Timestamp Error WAS Re: Function Creation Error |