Re: Date addition using Interval - Mailing list pgsql-general

From Stephan Szabo
Subject Re: Date addition using Interval
Date
Msg-id 20040505100146.A67492@megazone.bigpanda.com
Whole thread Raw
In response to Date addition using Interval  ("Sumita Biswas" <sbiswas@cisco.com>)
List pgsql-general
On Mon, 3 May 2004, Sumita Biswas wrote:

> Hi Experts,
>
> I try to write the following in my Function and it works:
>
> ld_FromDateTemp := ld_FromDate + ''5 DAYS''::interval;
>
> But when I have to pass a parameter in the NUMBER of days(instead of 5)
> like 'li_NoOfDays'
>
> ld_FromDateTemp := ld_FromDate +  ''li_NoOfDays DAYS''::interval;

This is a string containing 'li_NoOfDays DAYS' not
'<the value of li_NoOfDays> DAYS' so that's not going to work.

> If I write this way:
> ld_FromDateTemp := ld_FromDate +  li_NoOfDays ''DAYS''::interval;

I think you probably want:
li_NoOfDays * interval '1 day'

pgsql-general by date:

Previous
From: Chris Kratz
Date:
Subject: Re: example database setup
Next
From: Dardo D Kleiner - CONTRACTOR
Date:
Subject: Re: Load Balancing and Backup