Search Postgresql Archives

Re: Correct syntax

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

 



On 04/11/2014 10:58 AM, Victor Sterpu wrote:
How would I write sutch a query?
SELECT to_timestamp ('10-10-2013 15:00', 'DD-MM-YYYY HH24:MI') + interval REPLACE('1.30', '.', ':')||' hours'
This gives error at REPLACE.
Thank you.

The way you have interval, it expects a constant.  You need to cast your _expression_ like this:

SELECT to_timestamp ('10-10-2013 15:00', 'DD-MM-YYYY HH24:MI') + (REPLACE('1.30', '.', ':')||' hours')::interval
-- 
Vik

[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