Compile error in function - Mailing list pgsql-novice

From big_mafa
Subject Compile error in function
Date
Msg-id 001b01c3642d$229d83c0$1701a8c0@attila
Whole thread Raw
Responses Re: Compile error in function
List 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



pgsql-novice by date:

Previous
From: Josh Berkus
Date:
Subject: Re: using procedural languages...
Next
From: "big_mafa"
Date:
Subject: Re: Compile error in function