DROP FUNCTION IF EXISTS dbo.fn_GetHospReestrCost;

create function dbo.fn_GetHospReestrCost ("HospReestrID" UUID)
returns decimal(18, 2)
as $$
begin

return (
	select
		sum(STO)
	from
		AKUZ.T_HOSPITAL_REESTR_ITEM
	where
		HospitalReestr = "HospReestrID"
);
end $$ LANGUAGE plpgsql;
