Re: plpgsql related question: intervals and variables - Mailing list pgsql-sql

From Richard Huxton
Subject Re: plpgsql related question: intervals and variables
Date
Msg-id 200310211954.30195.dev@archonet.com
Whole thread Raw
In response to plpgsql related question: intervals and variables  (Wilhelm Graiss <Wilhelm.Graiss@bal.bmlfuw.gv.at>)
List 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 by date:

Previous
From: Josh Berkus
Date:
Subject: Re: plpgsql related question: intervals and variables
Next
From: Richard Huxton
Date:
Subject: Re: how to create a multi columns return function ?