--do $$
--begin
--	if exists 
--	(
--		select * from pg_proc p
--		inner join pg_namespace n on n.oid = p.pronamespace
--		where p.proname = 'fn_getekbhospreestrtotalcost'
--		and n.nspname = 'dbo'
--	)
--	then
--		drop function dbo.fn_getekbhospreestrtotalcost(uuid);
--	end if;
--end;
--$$ language plpgsql;

--CREATE OR REPLACE FUNCTION dbo.fn_GetEkbHospReestrTotalCost("HospReestrID" UUID)
--RETURNS Decimal(18,2) AS
-- $$
-- Begin
--	return
--	(
--		select sum(FACPRICE)
--		from akuz.T_HOSPITAL_BREE
--		where  bMain = "HospReestrID"
--	);	
--END $$
--language plpgsql stable;