Re: replacing expresion in plpgsql

From: John R Pierce <pierce(at)hogranch(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: replacing expresion in plpgsql
Date: 2013-12-16 00:23:47
Message-ID: 52AE4813.8090403@hogranch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Juan Pablo L 2013-12-16 00:52:51 Re: replacing expresion in plpgsql
Previous Message Andreas Brandl 2013-12-16 00:17:53 Re: replacing expresion in plpgsql