CREATE OR REPLACE FUNCTION food600.maz_dlhy(
	mc_stredisk integer,
	mc_dokl integer,
	mc_data integer)
    RETURNS integer
    LANGUAGE 'plpgsql'
    COST 100
    VOLATILE
AS $BODY$
BEGIN
	UPDATE food600.dluhy SET stornovano=1, provedl='INV', kdy=clock_timestamp() WHERE c_stredisk=mc_stredisk AND c_dokl<mc_dokl AND c_data=mc_data AND stornovano=0;
	RETURN 1;
END
$BODY$;
