[SQL] now() in loop statement

2003-09-29 Thread Kerv
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
'
DECLARE
	count int4;
	mytime timestamp;
BEGIN
	count := 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.

---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster


[SQL] Thanks for all replies

2003-09-29 Thread Kerv
Thank you,
Kerv
---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?
  http://www.postgresql.org/docs/faqs/FAQ.html