Re: plpgsql related question: intervals and variables

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: plpgsql related question: intervals and variables
Дата
Msg-id 20031021143506.M52534@megazone.bigpanda.com
обсуждение исходный текст
Ответ на Re: plpgsql related question: intervals and variables  (Josh Berkus <josh@agliodbs.com>)
Список pgsql-sql
On Tue, 21 Oct 2003, Josh Berkus 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'';
>
> PL/pgSQL handles variable like SQL, not like PHP or Perl.  You can't do a
> variable substitution inside quotes, and you need to cast:
>
> ez  := heute + interval (cast(vk as text) ||  '' days'');

I think that something likeez := heute + vk * interval '1 day';
might be better in general.



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: function problem
Следующее
От: Abdul Wahab Dahalan
Дата:
Сообщение: Timestamp