| From: | Juan Pablo L <jpablolorenzetti(at)gmail(dot)com> |
|---|---|
| To: | John R Pierce <pierce(at)hogranch(dot)com> |
| Cc: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: replacing expresion in plpgsql |
| Date: | 2013-12-16 00:53:53 |
| Message-ID: | CABSYDaZdDg5hgJ=VbMHhfK3tcL8enFbKf5Noob++SqyiuVuN4A@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Hi, thank you very much, this worked flawlessly, this is the final code:
execute 'select CURRENT_TIMESTAMP + $1 * interval ''1 day''' into
newexpdate using expdays;
works perfect, thanks a ton!
On 15 December 2013 18:23, John R Pierce <pierce(at)hogranch(dot)com> wrote:
> On 12/15/2013 4:17 PM, Andreas Brandl wrote:
>
>> select current_timestamp, current_timestamp + interval '2' day;
>>
>
> that should be interval '2 day' (note the ' moved), and for a variable
> number passed as a parameter, try...
>
> select current_timestamp, current_timestamp + $1 * interval '1 day';
>
> note this will work with values in hours, months, any unit, really.
>
>
> --
> john r pierce 37N 122W
> somewhere on the middle of the left coast
>
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Andreas Brandl | 2013-12-16 01:02:18 | Re: replacing expresion in plpgsql |
| Previous Message | Juan Pablo L | 2013-12-16 00:52:51 | Re: replacing expresion in plpgsql |