plpgsql related question: intervals and variables

From: Wilhelm Graiss <Wilhelm(dot)Graiss(at)bal(dot)bmlfuw(dot)gv(dot)at>
To: "'pgsql-sql(at)postgresql(dot)org'" <pgsql-sql(at)postgresql(dot)org>
Subject: plpgsql related question: intervals and variables
Date: 2003-10-21 13:58:20
Message-ID: 40925A3BA1EBD711A35C000102B6E57D06C9A7@BAL_PROXY00
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hello out there,

We have a problem in plpgsql:
We want to add variable periods (result of a query) to a timestamp.

Our Code looks like this:

Begin

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

We get the following:
ERROR: Bad interval external representation 'vk days'

The variable 'heute' is declared as timestamp,
'vk' as integer!

What have we done wrong??

:(

Thanks in advance,

Willi, Albin

--
=============================
Wilhelm Graiss
Altirdning 12
8952 Irdning
03682/22451/267

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Josh Berkus 2003-10-21 16:33:44 Re: Fw: Max input parameter for a function
Previous Message jclaudio 2003-10-21 13:08:28 how to create a multi columns return function ?