X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 6BAE5D1B51A for ; Mon, 29 Sep 2003 13:03:01 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 76613-09 for ; Mon, 29 Sep 2003 10:02:35 -0300 (ADT) Received: from news.hub.org (unknown [64.117.224.194]) by svr1.postgresql.org (Postfix) with ESMTP id 8624ED1B528 for ; Mon, 29 Sep 2003 10:02:32 -0300 (ADT) Received: from news.hub.org (host-64-117-224-194.altec1.com [64.117.224.194] (may be forged)) by news.hub.org (8.12.9/8.12.9) with ESMTP id h8TD2UhK039631 for ; Mon, 29 Sep 2003 13:02:30 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id h8TCwQqZ038408 for pgsql-sql@postgresql.org; Mon, 29 Sep 2003 12:58:26 GMT From: Kerv X-Newsgroups: comp.databases.postgresql.sql Subject: now() in loop statement Date: Mon, 29 Sep 2003 15:58:30 +0300 Organization: Hub.Org Networking Services Lines: 34 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030612 X-Accept-Language: en-us, en To: pgsql-sql@postgresql.org X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/379 X-Sequence-Number: 15357 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.