slight modification to the previous post, sorry, see http://www.postgresql.org/docs/8.0/interactive/plpgsql-structure.html for the real docs. CREATE OR REPLACE FUNCTION "public"."cproc_hli" (bgtemp NUMERIC, humidity NUMERIC, wspeed NUMERIC) RETURNS NUMERIC AS $$ BEGIN IF ($1 < 25) THEN SELECT (10.66 * (0.28 * $2)+(1.3 * $1) - $3) ; ELSE SELECT (8.62 * (0.38 * $2) + (1.55 * $1) - (0.5 * $3) + (exp(- $3 + 2.4))) ; END IF ; END ; $$ LANGUAGE 'plpgsql' VOLATILE RETURNS NULL ON NULL INPUT SECURITY INVOKER; ---------------------------(end of broadcast)--------------------------- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to majordomo@xxxxxxxxxxxxxx so that your message can get through to the mailing list cleanly