Delimiter //
/**
 * Guaranteed data copy
 * @param int batchnum
 * @author Ben
 */
Drop Procedure If Exists LOADER_GUARANTEED_COPY//

Create Procedure LOADER_GUARANTEED_COPY (
    In batchnum Int
)
Begin

    Call LOADER_GUARANTEED_GUARANTEED_UPDATE(batchnum);

    Call CASH_AUTOINCREMENT_VALUE('GUARANTEED', @lastGuaranteedId);
    Call LOADER_GUARANTEED_GUARANTEED_INSERT(batchnum, @lastGuaranteedId);

End //

Delimiter ;