Delimiter //
/**
 * Guaranteed data normalization
 * @param int batchnum
 * @author Ben
 */
Drop Procedure If Exists LOADER_GUARANTEED_NORMALIZE//

Create Procedure LOADER_GUARANTEED_NORMALIZE (
    In batchnum Int
)
MAIN_GUARANTEED_NORMALIZE: Begin

    -- Mandatory checks
	Call LOADER_GUARANTEED_NORMALIZE_ACCOUNT_REF_NOT_NULL(batchnum);
	Call LOADER_GUARANTEED_NORMALIZE_NAME_NOT_NULL(batchnum);
	Call LOADER_GUARANTEED_NORMALIZE_AMOUNT_NOT_NULL(batchnum);

	-- Mapping and linking
    Call LOADER_GUARANTEED_NORMALIZE_MAP_ACCOUNTS(batchnum); -- before LOADER_GUARANTEED_NORMALIZE_MAP_ACCOUNTS
    Call LOADER_GUARANTEED_NORMALIZE_MAP_CREATE_OR_UPDATE(batchnum); -- after LOADER_GUARANTEED_NORMALIZE_MAP_ACCOUNTS
    Call LOADER_GUARANTEED_NORMALIZE_MAP_DATE_NOT_PROVIDED(batchnum);

End//

Delimiter ;