關於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)。