Re: Date addition using Interval

From: Richard Huxton <dev(at)archonet(dot)com>
To: Sumita Biswas <sbiswas(at)cisco(dot)com>
Cc: 'Kris Jurka' <books(at)ejurka(dot)com>, 'Tom Lane' <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-general(at)postgresql(dot)org
Subject: Re: Date addition using Interval
Date: 2004-05-05 16:17:35
Message-ID: 4099139F.20804@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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;

You want ... + (li_NoOfDays || '' DAYS'')::interval;

plpgsql doesn't interpolate variables like perl/php do.

--
Richard Huxton
Archonet Ltd

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alexander Cohen 2004-05-05 16:30:07 list types
Previous Message Adam Ruth 2004-05-05 16:12:00 Re: PERFORM function in Plpgsql