Delimiter //
/**
 * Find the id of the given sequence
 * 
 */
Drop Procedure If Exists LOADER_REFDATALABEL_NORMALIZE_MAP_LANGUAGE_PROVIDED//
Create Procedure LOADER_REFDATALABEL_NORMALIZE_MAP_LANGUAGE_PROVIDED(
    In batchnum Int
)
Begin
    
    UPDATE
        LOADER_REFDATALABEL SRC
        INNER JOIN LOADER_STATUS LST
            ON LST.ID_LOADER_STATUS = SRC.LOADER_STATUS_ID_LOADER_STATUS
        LEFT JOIN DF_LANGUAGES DFL
            ON DFL.DF_LANGUAGES_CODE = SRC.DF_LANGUAGES_CODE
    SET
        SRC.DF_LANGUAGES_ID_DF_LANGUAGES = DFL.ID_DF_LANGUAGES
        
    WHERE 
        LST.LOADER_STATUS_BATCH_NUM = batchnum
        AND Coalesce(SRC.DF_LANGUAGES_CODE, '') != ''
    ;

End//
Delimiter ;