Re: replacing expresion in plpgsql - Mailing list pgsql-general

From John R Pierce
Subject Re: replacing expresion in plpgsql
Date
Msg-id 52AE4813.8090403@hogranch.com
Whole thread Raw
In response to Re: replacing expresion in plpgsql  (Andreas Brandl <ml@3.141592654.de>)
Responses Re: replacing expresion in plpgsql  (Juan Pablo L <jpablolorenzetti@gmail.com>)
Re: replacing expresion in plpgsql  (Andreas Brandl <ml@3.141592654.de>)
Re: replacing expresion in plpgsql  (Thomas Kellerer <spam_eater@gmx.net>)
List pgsql-general
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



pgsql-general by date:

Previous
From: Andreas Brandl
Date:
Subject: Re: replacing expresion in plpgsql
Next
From: Juan Pablo L
Date:
Subject: Re: replacing expresion in plpgsql