| From: | Stephan Szabo <sszabo(at)megazone(dot)bigpanda(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 17:03:22 |
| Message-ID: | 20040505100146.A67492@megazone.bigpanda.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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'
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Steve Atkins | 2004-05-05 17:06:02 | Re: Load Balancing and Backup |
| Previous Message | Chris Kratz | 2004-05-05 17:03:03 | Re: example database setup |