mybatis oracle 循环 insert update 日期格式 踩坑

  1. mybatis 中操作oracle数据库,循环标签要注意  index="index" open="begin" close=";end;" 这一段代码
  2. 日期字段 lastModifiedDateStr 为字符串String类型,然后使用 to_date 函数格式化
    <update id="batchUpdate">
            <foreach collection="pos" item="po" separator=";" index="index" open="begin" close=";end;">
                UPDATE
                ITEM.CUST_DIST_PRICE
                SET
                FXPF_PRICE = #{po.fxpfPrice},
                NEW_FXPF_PRICE = #{po.newFxpfPrice},
                OLD_FXPF_PRICE = #{po.oldFxpfPrice},
                ERROR_REASON = #{po.errorReason},
                CREATION_DATE =
                to_date(#{po.creationDateStr},'YYYY-MM-DD hh24:mi:ss'),
                CREATION_BY = #{po.creationBy},
                LAST_MODIFIED_DATE =
                to_date(#{po.lastModifiedDateStr},'YYYY-MM-DD hh24:mi:ss'),
                LAST_MODIFIED_BY = #{po.lastModifiedBy},
                IS_DELETE = #{po.deleted}
                where
                CUST_DIST_PRICE_ID = #{po.id}
            </foreach>
        </update>
原文地址:https://www.cnblogs.com/xiaodu9499/p/13036248.html