关于mybatis的 insert into select 命令未结束问题

来源:互联网 发布:ink域名续费 编辑:程序博客网 时间:2024/05/06 09:17

关于mybatis的 insert into select 命令未结束问题,最后以为是sql写错了,但是,在plsql执行又没问题。最后还是解决问题,

是设置问题。

### Cause: java.sql.SQLSyntaxErrorException: ORA-00933: SQL 命令未正确结束

原先的配置:

  <insert id="addHistoryByPostBatchno" parameterType="paramMap" >

修改了以后,加了
 useGeneratedKeys="false"

<insert id="addHistoryByPostBatchno" parameterType="paramMap" useGeneratedKeys="false" >  Insert into   Tb_Dispatch_Mail_History  (  mail_no, rec_name, rec_address, rec_telephone,   customer_no, post_opter, mail_content_name, mail_weight,  actual_postage, delivery_area, post_time, post_condition,      post_status, post_batchNo, customer_id   )   select    mail_no, rec_name, rec_address, rec_telephone,    customer_no, post_opter, mail_content_name, mail_weight,   actual_postage, delivery_area, post_time, post_condition,   post_status, post_batchNo, customer_id   from Tb_Dispatch_Mail_Post tp  <where>     tp.post_batchno=#{paramMap.postBatchno}  </where>  </insert>  
 问题顺利解决,不在报错。如果你也遇到同样问题,请留言一起探讨,我也只是解决了问题而已。如果看到这里你解决了问题,麻烦点赞吧!


官网的解释是
允许 JDBC 支持自动生成主键,需要驱动兼容。如果设置为 true 则这个设置强制使用自动生成主键,尽管一些驱动不能兼容但仍可正常工作(比如 Derby)。

2 0
原创粉丝点击