mybatis批量插入oracle一个大坑

默认xml

  
        INSERT INTO T_CAR_INFO(VEH_PLATE,VEH_PLATE_AUTO,VEH_TYPE, VEH_CLASS,IS_TRUCK,
        DATE_TIME,COLOR,VEH_CITY,VEH_PROVINCE,NOTE,VEH_TYPE_NUM,RATE)
        
            SELECT #{info.vehPlate,jdbcType=VARCHAR},
            #{info.vehPlateAuto,jdbcType=VARCHAR},
            #{info.vehType,jdbcType=NUMERIC},
            #{info.vehClass,jdbcType=NUMERIC},
            #{info.isTruck,jdbcType=VARCHAR},
            #{info.dateTime,jdbcType=VARCHAR},
            #{info.color,jdbcType=VARCHAR},
            #{info.vehCity,jdbcType=VARCHAR},
            #{info.vehProvince,jdbcType=VARCHAR},
            #{info.note,jdbcType=VARCHAR},
            #{info.vehTypeNum,jdbcType=NUMERIC},
            #{info.rate,jdbcType=NUMERIC,javaType=DOUBLE}
            FROM dual
        
    

直接报错语法错误  原因是 useGeneratedKeys 默认是 ture 添加useGeneratedKeys="false"即可解决 

  
        INSERT INTO T_CAR_INFO(VEH_PLATE,VEH_PLATE_AUTO,VEH_TYPE, VEH_CLASS,IS_TRUCK,
        DATE_TIME,COLOR,VEH_CITY,VEH_PROVINCE,NOTE,VEH_TYPE_NUM,RATE)
        
            SELECT #{info.vehPlate,jdbcType=VARCHAR},
            #{info.vehPlateAuto,jdbcType=VARCHAR},
            #{info.vehType,jdbcType=NUMERIC},
            #{info.vehClass,jdbcType=NUMERIC},
            #{info.isTruck,jdbcType=VARCHAR},
            #{info.dateTime,jdbcType=VARCHAR},
            #{info.color,jdbcType=VARCHAR},
            #{info.vehCity,jdbcType=VARCHAR},
            #{info.vehProvince,jdbcType=VARCHAR},
            #{info.note,jdbcType=VARCHAR},
            #{info.vehTypeNum,jdbcType=NUMERIC},
            #{info.rate,jdbcType=NUMERIC,javaType=DOUBLE}
            FROM dual
        
    

 

 

你可能感兴趣的:(mybatis)