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

From Wilhelm Graiss
Subject plpgsql related question: intervals and variables
Date
Msg-id 40925A3BA1EBD711A35C000102B6E57D06C9A7@BAL_PROXY00
Whole thread Raw
Responses Re: plpgsql related question: intervals and variables
Re: plpgsql related question: intervals and variables
List 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 Thenvk_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





pgsql-sql by date:

Previous
From: Peter Eisentraut
Date:
Subject: [postgres] Re: Deutsche PostgreSQL-Mailingliste unter postgresql.org
Next
From: jclaudio@capitol.fr
Date:
Subject: how to create a multi columns return function ?