CREATE OR REPLACE FUNCTION food600.insertpolanumeric(
	newpole numeric,
	INOUT pocet integer,
	INOUT navrat character varying,
	INOUT polia character varying,
	INOUT navrat_master character varying,
	INOUT polia_master character varying,
	meno character varying)
    RETURNS record
    LANGUAGE 'plpgsql'
    COST 100
    VOLATILE
AS $BODY$
BEGIN
IF newpole IS NOT NULL THEN 
	IF pocet>0 THEN
		navrat:=navrat||',';
		polia:=polia||',';
		navrat_master:=navrat_master||',';
		polia_master:=polia_master||',';
	END IF;
	navrat_master:=navrat_master||btrim(newpole::character(20));
	polia_master:=polia_master||meno;
	navrat:=navrat||btrim(newpole::character(20));
	polia:=polia||meno;
	pocet:=pocet+1;
END IF;
END
$BODY$;
