1

I am able to insert many rows in single database call in MyBatis.
Below is my query -

<insert id="insert" parameterType="map">
          INSERT ALL
            <foreach collection="list" item="item" index="index" >
                 INTO TABLE(FIELD1,FIELD2) values
                 (#{item.field1},#{item.field2})
            </foreach>
          SELECT * FROM dual
</insert>

I want to do same batch opertaion with UPDATE also.

rtruszk
  • 3,902
  • 13
  • 36
  • 53
sHOOT
  • 43
  • 6
  • 1
    Check this http://stackoverflow.com/questions/17928799/how-to-implement-batch-operations-with-mybatis-spring?lq=1 – Sheetal Mohan Sharma Jun 12 '15 at 08:52
  • I am getting error as - " ORA-00933: SQL command not properly ended " – sHOOT Jun 12 '15 at 09:38
  • and adding to this , the query I have written for Insert operation hits database only once, but this will hit number of times same as loop iterates, please add a comment on this also – sHOOT Jun 12 '15 at 09:40
  • possible duplicate of [MyBatis Batch Insert/Update For Oracle](http://stackoverflow.com/questions/23486547/mybatis-batch-insert-update-for-oracle) – Sameer Kazi Jun 23 '15 at 09:58
  • There is no batch update for Oracle in case you are going to update different values for different values. It can be done via generated callable procedure with several UPDATE statements. Take a look on example: http://stackoverflow.com/a/8338725/1345788 – sphinks Jan 10 '17 at 11:49

0 Answers0