Re: plpgsql related question: intervals and variables

From: Richard Huxton <dev(at)archonet(dot)com>
To: Wilhelm Graiss <Wilhelm(dot)Graiss(at)bal(dot)bmlfuw(dot)gv(dot)at>, "'pgsql-sql(at)postgresql(dot)org'" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: plpgsql related question: intervals and variables
Date: 2003-10-21 18:54:30
Message-ID: 200310211954.30195.dev@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Richard Huxton 2003-10-21 18:57:17 Re: how to create a multi columns return function ?
Previous Message Josh Berkus 2003-10-21 18:43:02 Re: plpgsql related question: intervals and variables