Re: Correct syntax

Поиск
Список
Период
Сортировка
От Vik Fearing
Тема Re: Correct syntax
Дата
Msg-id 5347B2A1.2030205@dalibo.com
обсуждение исходный текст
Ответ на Correct syntax  ("Victor Sterpu" <victor@caido.ro>)
Список pgsql-general
On 04/11/2014 10:58 AM, Victor Sterpu wrote:
blockquote.cite { margin-left: 5px; margin-right: 0px; padding-left: 10px; padding-right:0px; border-left: 1px solid #cccccc } blockquote.cite2 {margin-left: 5px; margin-right: 0px; padding-left: 10px; padding-right:0px; border-left: 1px solid #cccccc; margin-top: 3px; padding-top: 0px; } .plain pre, .plain tt { font-family: monospace; font-size: 100%; font-weight: normal; font-style: normal; } body {font-family: Tahoma;font-size: 12pt;} .plain pre, .plain tt {font-family: Tahoma;font-size: 12pt;}
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

В списке pgsql-general по дате отправления:

Предыдущее
От: "Victor Sterpu"
Дата:
Сообщение: Correct syntax
Следующее
От: Alban Hertroys
Дата:
Сообщение: Re: Linux vs FreeBSD