mybatis中insert into ...select ...from dual union all select ... from dual 提示sql命令未結束的問題
需要在插入時加上useGeneratedKeys="false"
原Mapper:
<insert id="insertProductRoleUser" parameterType="list">
INSERT INTO AMC_PRODUCT_ROLE_USER
(user_id, role_id)
<foreach collection="list" item="productRole" index="index" separator="union all">
SELECT
#{productRole.user_id,jdbcType=VARCHAR},
#{productRole.role_id,jdbcType=VARCHAR}
FROM DUAL
</foreach>
</insert>
新Mapper:
<insert id="insertProductRoleUser" parameterType="list" useGeneratedKeys="false">
INSERT INTO AMC_PRODUCT_ROLE_USER
(user_id, role_id)
<foreach collection="list" item="productRole" index="index" separator="union all">
SELECT
#{productRole.user_id,jdbcType=VARCHAR},
#{productRole.role_id,jdbcType=VARCHAR}
FROM DUAL
</foreach>
</insert>
相關文章
- select into from 和 insert into select 的用法和區別
- insert into select語句與select into from語句
- SQL-Hive中的Select From解析SQLHive
- 關於 mysql 中的 select * from table_a,table_b 的問題MySql
- mysql insert into ... select的鎖問題MySql
- 【SQL】14 UNION 操作符、SELECT INTO 語句、INSERT INTO SELECT 語句、CREATE DATABASE 語句、CREATE TABLE 語句SQLDatabase
- insert into select
- sql中union和union all的用法SQL
- 解析MySQL中INSERT INTO SELECT的使用MySql
- sql中UNION和UNION ALL的區別SQL
- Hibernate中不支援複雜子查詢from (select ……)解決方案
- node express 在使用mysql執行SELECT count(*) from xx獲取總數取值格式問題ExpressMySql
- Laravel5.6 如何列印 SQL?insert/update/select 列印方法總結LaravelSQL
- [20180907]insert+with+select.txt
- java-Mybatis XML 對映器(select,insert, update 和 delete)JavaMyBatisXMLdelete
- SQL Server中的SELECT會阻塞SELECT相關資料SQLServer
- 工作總結 1 sql寫法 insert into select from 2 vs中 obj檔案和bin檔案 3 npoi 模板copy CopySheet 最好先全部Copy完後 再根據生成sh...SQLOBJ
- SQL__SELECTSQL
- mysql update join,insert select 語法MySql
- Oracle中的insert/insert all/insert firstOracle
- select into outfile問題一則
- SQL SELECT 語句SQL
- SQLite語句(二):INSERT DELETE UPDATE SELECTSQLitedelete
- [LeetCode] 317. Shortest Distance from All BuildingsLeetCodeUI
- LeetCode之All Paths From Source to Target(Kotlin)LeetCodeKotlin
- MySQL中SELECT+UPDATE併發更新問題MySql
- 阿里面試題: (a,b,c)組合索引, 查詢語句select...from...where a=.. and c=..走索引嗎?阿里面試題索引
- ORACLE SELECT INTO NO_DATA_FOUND問題Oracle
- 023 Given an integer n. get the number of 0, 2, 4 from all the values from [0, n]
- DBeaver如何生成select,update,delete,insert語句delete
- sqli-labs ————less -27(union、SELECT、繞過濾)SQL
- 佔用資源狂高的select min(bitmapped) from ts$ where dflmaxext =:1 and bitand(flags, 1024) = 1024APP
- DualGNN: Dual Graph Neural Network for Multimedia RecommendationGNN
- sql中select列有自定義函式 dblinkSQL函式
- laravel-admin select聯動問題Laravel
- sqli-labs ————less -27a(union、SELECT、繞過濾)SQL
- 完美解決html中select的option不能隱藏的問題。HTML
- union all和union的區別
- sql查詢更新update selectSQL