Re: plpgsql related question: intervals and variables

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: plpgsql related question: intervals and variables
Дата
Msg-id 200310211954.30195.dev@archonet.com
обсуждение исходный текст
Ответ на plpgsql related question: intervals and variables  (Wilhelm Graiss <Wilhelm.Graiss@bal.bmlfuw.gv.at>)
Список pgsql-sql
On Tuesday 21 October 2003 14:58, Wilhelm Graiss wrote:

>    heute := ''today'';
> Select Into vk ourcolumn From table where other = foo;
>    If vk > 0 Then
>     vk_txt := ''Vorkuehlung notwendig'';
>     ez  := heute + interval ''vk days'';

> The variable 'heute' is declared as timestamp,
> 'vk' as integer!
>
> What have we done wrong??

Quoted the vk variable. You want something like:

ez := heute + (vk || '' days'')::interval;

--  Richard Huxton Archonet Ltd


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

Предыдущее
От: Josh Berkus
Дата:
Сообщение: Re: plpgsql related question: intervals and variables
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: how to create a multi columns return function ?