Delimiter //
/**
 * Author:  armen
 * Created: 26 févr. 2018
 */
Drop Procedure If Exists LOADER_ACCOUNTS_NORMALIZE_MAP_INERNALSCORE_PROVIDED//
Create Procedure LOADER_ACCOUNTS_NORMALIZE_MAP_INERNALSCORE_PROVIDED(
    In batchnum Int
)
Begin
    Update
        LOADER_STATUS LS
        Inner Join LOADER_ACCOUNTS LA
            On LA.LOADER_STATUS_ID_LOADER_STATUS = LS.ID_LOADER_STATUS
    Set
        LA.FI_ANA_INTRSCORRATLASTUPDAT = Now()
        
    Where
        LS.LOADER_STATUS_BATCH_NUM = batchnum 
        And LA.FI_ANA_INTERNAL_SCORE_RATING Is Not Null
        And LA.FI_ANA_INTRSCORRATLASTUPDAT Is Null
    ;
End //
Delimiter ;