0

I tried MyBatis foreach statement to delete 500-like rows at once, but after the successful completion of the batch, part of the rows haven't been deleted which should be deleted.

What I suspect is how long mybatis dynamic query can be, because I am appending quite long items (each item is 40 to 50 chars long).

<delete id="delete" parameterType="List">
    DELETE FROM     
        table_name
    WHERE
        column_name IN <foreach collection="list" item="item" separator="," open="(" close=")">#{item}</foreach>
</delete>

Or any other clue?

Appreciate your help!

choiapril
  • 183
  • 1
  • 4
  • 14
  • i can't see a connection to spring batch here, can you explain more or remove the tag? – Michael Pralow Oct 08 '15 at 10:32
  • May I know this sql is being executed against which database? If it is Oracle, there is a certain limit related to IN clause. – Ian Lim Oct 09 '15 at 06:10
  • @choiapril please refer to http://stackoverflow.com/questions/8808845/mysql-is-there-a-limit-to-the-entries-of-an-in-clause which maybe helpful to you – Ian Lim Oct 14 '15 at 03:52
  • @IanLim Appreciate your help! But it was not the case. The problem was that I used a column which is not PK, in WHERE clause. – choiapril Oct 15 '15 at 05:39

0 Answers0