Mybatis will report an error when inserting multiple entries with foreach, but one will be fine, saying that there is a format error.

this is the xml file:

the following error:

-sharp-sharp-sharp Error updating database.  Cause: java.sql.SQLException: sql injection violation, syntax error: TODO : COMMA values : insert into BIA_HGU_INFO (HGU_ID, AREA_CODE, BIND_CODE, 
      SN, HGU_MAC, PRODUCT_CLASS, 
      HGU_VENDOR, SOFTWARE_VERSION, WIFI_FLAG, 
      PPPOE_USER, VOIP_USER, REMARK, 
      DEV_TYPE)
    values 
          
        (
          ?, 
          ?, 
          ?, 
          ?, 
          ?, 
          ?, 
          ?, 
          ?, 
          ?, 
          ?, 
          ?, 
          ?, 
          ?
        )
         , 
        (
          ?, 
          ?, 
          ?, 
          ?, 
          ?, 
          ?, 
          ?, 
          ?, 
          ?, 
          ?, 
          ?, 
          ?, 
          ?
        )
         
        ;
Mar.22,2021

<insert id="insertBatch" parameterType="java.util.List" useGeneratedKeys="false">
        INSERT INTO BIA_HGU_INFO (HGU_ID, AREA_CODE, BIND_CODE,
        SN, HGU_MAC, PRODUCT_CLASS, HGU_VENDOR, SOFTWARE_VERSION, WIFI_FLAG,
        PPPOE_USER, VOIP_USER, REMARK,
        DEV_TYPE)
        <foreach collection="hguInfolist" item="hguInfo" index="index" separator="union all">
            (SELECT
            -sharp{hguInfo.hguId, jdbcType=VARCHAR},
            -sharp{hguInfo.areaCode, jdbcType=VARCHAR},
            -sharp{hguInfo.bindCode, jdbcType=VARCHAR},
            -sharp{hguInfo.sn, jdbcType=VARCHAR},
            -sharp{hguInfo.hguMac, jdbcType=VARCHAR},
            -sharp{hguInfo.productClass, jdbcType=VARCHAR},
            -sharp{hguInfo.hguVendor, jdbcType=VARCHAR},
            -sharp{hguInfo.softwareVersion, jdbcType=VARCHAR},
            -sharp{hguInfo.wifiFlag, jdbcType=DECIMAL},
            -sharp{hguInfo.pppoeUser, jdbcType=VARCHAR},
            -sharp{hguInfo.voipUser, jdbcType=VARCHAR},
            -sharp{hguInfo.remark, jdbcType=VARCHAR},
            -sharp{hguInfo.devType, jdbcType=DECIMAL}
            FROM dual
            )
        </foreach>
    </insert>

you should use the connection pool of druid. The visual problem is the version of druid:
sql does not have Comment, throwing exception syntax error, COMMA values
upgrade druid to see if it can be written well


values. It is not a sql standard function. All I know is mysql support.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e4195d-43423.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e4195d-43423.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?