CREATE OR REPLACE FUNCTION food600.dajvarnamenumeric(
	lc_pgm character,
	lc_setup_skup character,
	lc_var_name character)
    RETURNS numeric
    LANGUAGE 'plpgsql'
    COST 100
    VOLATILE PARALLEL UNSAFE
AS $BODY$
DECLARE
lv_var_value BPCHAR;
lv_return	 NUMERIC;
BEGIN
SELECT var_value INTO lv_var_value FROM food600.defsubor WHERE modul=lc_pgm AND setup_skup=lc_setup_skup AND var_name=lc_var_name;
IF lv_var_value IS NULL THEN
	lv_return:=0::NUMERIC;
ELSE
	lv_return:=lv_var_value::NUMERIC;
END IF;
RETURN lv_return;
END
$BODY$;
