Search Postgresql Archives

Date addition using Interval

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

 



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;

Does not work. Error as follows:
------------------------------------------------------------------------
--------
WARNING:  Error occurred while executing PL/pgSQL function
proc_dailyutilization
WARNING:  line 41 at assignment
ERROR:  Bad interval external representation 'li_NoOfDays DAYS'
------------------------------------------------------------------------
--------
If I write this way:
ld_FromDateTemp := ld_FromDate +  li_NoOfDays ''DAYS''::interval;

Following Error:
------------------------------------------------------------------------
--------
WARNING:  Error occurred while executing PL/pgSQL function
proc_dailyutilization
WARNING:  line 41 at assignment
ERROR:  parser: parse error at or near "'DAYS'" at character 21
------------------------------------------------------------------------
--------


I am sure there is a way of doing it. Can anyone point out where I am
going wrong?

Thanks in Advance.

Regards,
Sumita




---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to majordomo@postgresql.org so that your
      message can get through to the mailing list cleanly

[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