CREATE OR REPLACE FUNCTION food600.updatepoladate(
	oldpole date,
	newpole date,
	INOUT pocet integer,
	INOUT navrat character varying,
	INOUT navrat_master character varying,
	meno character varying)
    RETURNS record
    LANGUAGE 'plpgsql'
    COST 100
    VOLATILE
AS $BODY$
BEGIN
IF (newpole != oldpole) THEN 
	IF pocet>0 THEN
		navrat:=navrat||',';
		navrat_master:=navrat_master||',';
	END IF;
	navrat:=navrat||meno||'=to_date('''||to_char(newpole,'YYYYMMDD')||''',''YYYYMMDD'')';
	navrat_master:=navrat_master||meno||'=to_date('''||to_char(newpole,'YYYYMMDD')||''',''YYYYMMDD'')';
	pocet:=pocet+1;
END IF;
END
$BODY$;
