Use <foreach></foreach> Bulk Insert times wrong ORA-00911: Invalid character error
<collection= "List" item= "item" index= "Index" separator= ";" > INSERT INTO table1 (column1) VALUES (#{item.num})</foreach>
Mybatis will print the following SQL statement, and error
Insert into Values (insertvalues ()
The above statement is a legitimate SQL statement and can be executed in the SQL tool. * * * * error because MyBatis does not recognize this is a bulk operation of the 2 statements, close to; the number cannot be completed *******
WORKAROUND: Increase the operator of the foreach node
Use the following settings
<collection= "List" item= "item" index= "Index" Open= "Begin" close= "; end;" Separator =";" > </ foreach >
The newly printed SQL will look like this:
begin Insert into Values (insertvalues (); End;
Mybatis Bulk Update ORA-00911: Invalid character error