From: Kerv <keresztes_m@yahoo.com>
To: pgsql-sql@postgresql.org
Subject: now() in loop statement
Date: Mon, 29 Sep 2003 15:58:30 +0300
Message-ID: <bl9a9i$15g5$1@news.hub.org> (raw)
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.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: keresztes_m@yahoo.com
Subject: Re: now() in loop statement
In-Reply-To: <bl9a9i$15g5$1@news.hub.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox