批量插入clob字段
<insert id="batchInsertVideo" parameterType="java.util.List">
begin
<foreach collection="list" item="item" index="index" separator=";">
insert into WECHAT_VIDEO_INFO(VIDEO_ID,
...........
COVER,
media_file_content,
CREATE_TIME,
UPDATE_TIME,
PUBLISH_TIME)
values (
............
#{item.cover,jdbcType=CLOB},
#{item.mediaFileContent,jdbcType=CLOB},
sysdate,
sysdate,
sysdate
)
</foreach>
;end ;
</insert>
不包含clob类型的批量插入写法: 注意list需要非空,否则会报异常sql缺失values关键字
<insert id="batchInsertCatlogVideo" parameterType="java.util.List">
insert into WECHAT_VIDEO_CATALOG_ASSOCIATE(CATALOG_ID, VIDEO_ID,CREATE_TIME,UPDATE_TIME)
<foreach collection="list" item="item" index="index" open="(" close=")" separator="union all">
select #{item.catalogId,jdbcType=VARCHAR},
#{item.videoId,jdbcType=VARCHAR},sysdate,sysdate
from dual
</foreach>
</insert>
clob的时候不能这样写,否则的会报异常:
|