Compile error in function

From: "big_mafa" <big_mafa(at)freemail(dot)hu>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: Compile error in function
Date: 2003-08-16 19:32:30
Message-ID: 001b01c3642d$229d83c0$1701a8c0@attila
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi!

There is a very annoying problem.
I created a very simple function, which can be created well, but if I call
it, the following problem occurs:
ERROR: parse error at or near "IF"
WARNING: plpgsql: ERROR during compile of cre_kitchen_log near line 1

The Function is:

CREATE OR REPLACE FUNCTION "public"."cre_kitchen_log" (date) RETURNS integer
AS'
IF not exists(select count(*) from kitchenlog where dat = $1) THEN
insert into kitchenlog(dat,prodid) select $1 , id from products where
incl=''T'';
END IF;
select 1 as result;
'LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY DEFINER;

I created this function using EMS PostgreSQLManager. I Copied it to pgsql
(to be sure, there is no CR/LF in code) - but the result is the same.

Could someone help me? Thanks! Attila

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message big_mafa 2003-08-16 19:43:28 Re: Compile error in function
Previous Message Josh Berkus 2003-08-15 21:29:30 Re: using procedural languages...