Delimiter //
/**
 * Accounts ref data normalization
 * 
 */

Drop Procedure If Exists LOADER_REFDATALABEL_NORMALIZE//
Create Procedure LOADER_REFDATALABEL_NORMALIZE (
    In batchnum Int
)
MAIN_REFDATALABEL_NORMALIZE: Begin

    

    -- Mandatory checks

	call LOADER_REFDATALABEL_NORMALIZE_CHECK_REFTYPE(batchnum);

    Call LOADER_REFDATALABEL_NORMALIZE_ENTITIES_REF_SEQUENCE_NOT_NULL(batchnum);

    Call LOADER_REFDATALABEL_NORMALIZE_ENTITIES_REF_SEQUENCE_RANGE(batchnum);

    Call LOADER_REFDATALABEL_NORMALIZE_MAP_LANGUAGE_PROVIDED(batchnum); -- doit être lancé avant LOADER_REFDATALABEL_NORMALIZE_MAP_LANGUAGE_NOT_PROVIDED
    Call LOADER_REFDATALABEL_NORMALIZE_MAP_LANGUAGE_NOT_PROVIDED(batchnum); -- doit être lancé apres LOADER_REFDATALABEL_NORMALIZE_MAP_LANGUAGE_PROVIDED

    Call LOADER_REFDATALABEL_NORMALIZE_MAP_ID_ENT_REF(batchnum);
    Call LOADER_REFDATALABEL_NORMALIZE_MAP_ID_ENT_REF_DATAS(batchnum); -- doit être lancé apres LOADER_REFDATALABEL_NORMALIZE_MAP_ID_ENT_REF
    
    Call LOADER_REFDATALABEL_NORMALIZE_MAP_ID_ENT_REF_DATAS_LNG(batchnum);
    

End//
Delimiter ;