now() in loop statement

Поиск
Список
Период
Сортировка
От Kerv
Тема now() in loop statement
Дата
Msg-id bl9a9i$15g5$1@news.hub.org
обсуждение исходный текст
Ответы Re: now() in loop statement  (Tomasz Myrta <jasiek@klaster.net>)
Re: now() in loop statement  (Christoph Haller <ch@rodos.fzk.de>)
Re: now() in loop statement  ("Dan Langille" <dan@langille.org>)
Thanks for all replies  (Kerv <keresztes_m@yahoo.com>)
Список pgsql-sql
Hello,

What is wrong with this function because the mytime variable contain the 
same value in each iteration:
CREATE OR REPLACE FUNCTION public.time_test()  RETURNS int4 AS
'
DECLAREcount int4;mytime timestamp;
BEGINcount := 0;mytime := now();while count <= 25 loop    mytime := now();    RAISE NOTICE \'Time: %\',mytime;    count
:=count + 1;end loop;RAISE NOTICE \'Count: %\',count;RETURN count;
 
END;
'  LANGUAGE 'plpgsql' VOLATILE;

the result is:
NOTICE:  Time: 2003-09-29 15:52:06.745317
.
.
.
NOTICE:  Time: 2003-09-29 15:52:06.745317 --same with the first value!!!
NOTICE:  Count: 26

Thanks.



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

Предыдущее
От: Christoph Haller
Дата:
Сообщение: Re: Data Calculation
Следующее
От: Tomasz Myrta
Дата:
Сообщение: Re: now() in loop statement