Function problem

Поиск
Список
Период
Сортировка
От Oscar Chavarria
Тема Function problem
Дата
Msg-id 716841580704090716g2b19193fm3f4a06c463649067@mail.gmail.com
обсуждение исходный текст
Ответы Re: Function problem
Re: Function problem
Список 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

В списке pgsql-novice по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Odd Timestamp Error WAS Re: Function Creation Error
Следующее
От: Stephan Szabo
Дата:
Сообщение: Re: Function problem