您的位置:首页 > 其它

关于mybatis的insertintoselect命令未结束问题

2016-05-09 16:51 531 查看
关于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)。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  mybatis