insert multiple rows into DB2 database

前端 未结 5 566
野趣味
野趣味 2020-12-05 04:20

I want to insert multiple rows into a DB2 table. I have a query that looks like this

insert into tableName 
(col1, col2, col3, col4, col5) 
values 
(val1, va         


        
5条回答
  •  误落风尘
    2020-12-05 05:09

    I disagree on the comment posted by Hogan. Those instructions will work for IBM DB2 Mini, but it's not the case of DB2 Z/OS.

    Here is an example:

    Exception data: org.apache.ibatis.exceptions.PersistenceException:
    The error occurred while setting parameters
    
    SQL: INSERT INTO TABLENAME(ID_, F1_, F2_, F3_, F4_, F5_) VALUES
     (?,          1,          ?,          ?,          ?,          ?),          
     (?,          1,          ?,          ?,          ?,          ?)
    
    
    Cause: com.ibm.db2.jcc.am.SqlSyntaxErrorException: 
    ILLEGAL SYMBOL ",". SOME SYMBOLS THAT MIGHT BE LEGAL ARE: FOR  NOT ATOMIC. SQLCODE=-104, SQLSTATE=42601, DRIVER=4.25.17
    

    So I can confirm that inline comma separated bulk inserts are not working on DB2 Z/OS (maybe you could feed it some props to get it working...)

提交回复
热议问题