Delimiter //
/**
* verifie si au moins l'un des champ nécéssaire (login ou contact ref)
* pour déterminer le membre à été fournis
**/

Drop Procedure if exists LOADER_MEMBERSACCRED_NORMALIZE_CHECK_LOGIN_OR_CTC_REF_PROVIDED//

Create Procedure LOADER_MEMBERSACCRED_NORMALIZE_CHECK_LOGIN_OR_CTC_REF_PROVIDED (
    In batchnum int
)
Begin

    Set @query = null;
	call LOADER_BUILD_CHECK_BASE_QUERY('LOADER_MEMBERSACCRED'
                                    , 'MEMBERS_LOGIN,CONTACTS_REF'
                                    , 'LOADER_STATUS_BATCH_NUM', batchnum, 'ERRCOUNT', 'ERRMSGS'
                                    , 'Neither of expected fields was provided', null, null
                                    , @query
                                )
                            ;
	set @query = Concat(@query, ' And ( Trim(Coalesce(trgt.MEMBERS_LOGIN, '''')) = '''') And ( Trim(Coalesce(trgt.CONTACTS_REF, '''')) = '''')');
	PREPARE stmt FROM @query;
	execute stmt			
		;
	Deallocate prepare stmt;

End //
Delimiter ;