--do $$
--begin
--	if exists 
--	(
--		select * from pg_proc p
--		where p.proname = 'sp_senddrugsdictionary'
--	)
--	then
--		drop function public.sp_senddrugsdictionary(xml);
--	end if;
--end;
--$$ language plpgsql;
---- =============================================
---- Author:		ЗАО Витакор
---- Create date: 2016.02.11
---- Description:	[dbo].[public.sp_sendDrugsDictionary] 
---- =============================================
--CREATE or REPLACE FUNCTION public.sp_sendDrugsDictionary
--(
--	"Doc" xml
--)
--RETURNS Table (c1 Text) AS
--$$
--BEGIN
--	If "Doc" Is NULL
--	then
--		return query Select '1'::text as ExitCode;
--		return query Select 'Ошибка'::text as Err;
--		return;	
--	end if;

--	-- результат
--	return query Select '0'::text as ExitCode;
--	return query Select 'Ok'::text as Msg;
--	return;
--END
--$$ LANGUAGE plpgsql immutable;