X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7EE62563AA for ; Wed, 9 Mar 2005 09:17:55 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 25213-10 for ; Wed, 9 Mar 2005 09:17:46 +0000 (GMT) Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id 8A9BF563E7 for ; Wed, 9 Mar 2005 09:17:43 +0000 (GMT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id j299Hbxp012008 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 9 Mar 2005 02:17:39 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.3/8.13.3) with ESMTP id j299Ha04029774; Wed, 9 Mar 2005 02:17:36 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.3/8.13.3/Submit) id j299Ha5w029773; Wed, 9 Mar 2005 02:17:36 -0700 (MST) (envelope-from mfuhr) Date: Wed, 9 Mar 2005 02:17:36 -0700 From: Michael Fuhr To: Fatih Cerit Cc: pgsql-sql@postgresql.org Subject: Re: interval +variable Message-ID: <20050309091736.GA29736@winnie.fuhr.org> References: <008a01c52486$1c1c9520$bb41ccd5@cerit> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <008a01c52486$1c1c9520$bb41ccd5@cerit> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.004 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200503/141 X-Sequence-Number: 20620 On Wed, Mar 09, 2005 at 10:58:05AM +0200, Fatih Cerit wrote: > Is there anyone at there who knows howto use dateadd in pgsql. I have a > problem in my function that is like this ; > > Select into futuredate now() + interval '30 days'; <- this is ok > but how can I use a variable intead of '30 days' :( Are you looking for something like this? ndays := 30; SELECT INTO futuredate now() + ndays * interval'1 day'; -- Michael Fuhr http://www.fuhr.org/~mfuhr/