Re: interval +variable - Mailing list pgsql-sql

From Michael Fuhr
Subject Re: interval +variable
Date
Msg-id 20050309091736.GA29736@winnie.fuhr.org
Whole thread Raw
In response to interval +variable  ("Fatih Cerit" <fatih@intersan.com.tr>)
List pgsql-sql
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/


pgsql-sql by date:

Previous
From: "Fatih Cerit"
Date:
Subject: interval +variable
Next
From: Kenneth Gonsalves
Date:
Subject: Re: datestyle setting