Search Postgresql Archives

Re: Date addition using Interval

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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'

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux