码迷,mamicode.com
首页 > 数据库 > 详细

mybatis + oracle insert clob,出现ORA-01461:仅能绑定要插入LONG列的LONG值

时间:2018-01-30 16:55:42      阅读:505      评论:0      收藏:0      [点我收藏+]

标签:插入   oracl   from   gpo   union   for   类型   col   tor   

在网上查了很久,有可能问题是出现在当从dual中取数据时,会将clob对象的字段转为Long型

最后的解决方法用到了Begin和end语法:

1.用到begin 和end

2.用到insert into value()语法

不能用insert into select from dual (union all)语法

3.参数,指定 jdbcType=CLOB 类型

 <insert id="batchInsert" parameterType="java.util.List">
    begin
    <foreach collection="list" item="item" index="index" separator=";">
       insert into tableName(ID, content) 
       values( #{item.id},#{item.content,jdbcType=CLOB})
    </foreach> 
    ;end;
  </insert>

 

mybatis + oracle insert clob,出现ORA-01461:仅能绑定要插入LONG列的LONG值

标签:插入   oracl   from   gpo   union   for   类型   col   tor   

原文地址:https://www.cnblogs.com/xiaoliu66007/p/8384519.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!