Willhelm,

> 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'';    

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'');

Also, the string 'today' has no special meaning in PL/pgSQL.  I think you want 
now() instead.

I'm afraid that you're going to need a tutorial on SQL datatypes, casting, and 
similar issues ... I wish I had one to recommend to you.  Just keep in mind 
that SQL scripting languages (like PL/pgSQL) are not Perl!

-- 
-Josh Berkus
 Aglio Database Solutions
 San Francisco


---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
      joining column's datatypes do not match

Reply via email to