Delimiter //
/**
 * Transform the contact's last name in uppercase
 *
 * @param int batchnum
 * @return void
 * @author Ben
 * @ticket #6704
 */
Drop Procedure if exists LOADER_CONTACTS_NORMALIZE_MAP_LAST_NAME_PROVIDED//

Create Procedure LOADER_CONTACTS_NORMALIZE_MAP_LAST_NAME_PROVIDED (
    In batchnum int
)
Begin
    
    UPDATE
        LOADER_CONTACTS C
        INNER JOIN LOADER_STATUS S
            ON S.ID_LOADER_STATUS = C.LOADER_STATUS_ID_LOADER_STATUS
    SET
        C.CONTACTS_INDIVIDUAL_LAST_NAME = UPPER(C.CONTACTS_INDIVIDUAL_LAST_NAME)
    WHERE 
        S.LOADER_STATUS_BATCH_NUM = batchnum
    ;

End //

Delimiter ;
