select  
		nullif(error_code,'0') as Error_Code, 
		nullif(ltrim(rtrim(error_message)),'') as Error_Message, 
		case when error_Code = '0' then 1 else 0 end as Success, 
		BookRmis_id,
		BookRmis_Time
	from fer.xp_CreateAppointmentTyped(
		Timetable_Guid => $1::uuid,
		LpuUnit_id=> $2,
		Person_id=> $3,
		EvnDirection_Num=> null::varchar(20),
		Diff_Time=> 1::bigint,
		AppointmentType_id=> $4::int,
		AppointmentSourceId=> $5::bigint,
		bookrmis_id => NULL::varchar,
		bookrmis_time => NULL::timestamp,
		pmUser_id=> 999900::bigint
	)
