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>

     


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM