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