
sql insert语法报错
报错原因:
在提供的插入语句中,storageroom 字段后面缺少逗号。类似于以下示例 sql:
insert newschema.new_table (name,) values ('hello',);正确语法应该为:
insert newschema.new_table (name) values ('hello');在您提供的映射文件中,storageroom 字段后面也缺少逗号:
<if test="storageroom != null and storageroom != ''">storageroom,</if>
修改后,正确的映射文件内容为:
<insert id="insertPnAssertRukuDetails" parameterType="com.ruoyi.system.domain.PnModelInOutInventory">
insert into pnAssertRukuDetails (
<if test="parentPnAssertRukuId != null and parentPnAssertRukuId != ''">parent_pnAssertRuku_id,</if>
<if test="materialInformation != null and materialInformation != ''">materialInformation,</if>
<if test="numbersRuKu != null and numbersRuKu != ''">numbersRuKu,</if>
<if test="qualified != null and qualified != ''">qualified,</if>
<if test="unit != null and unit != ''">unit,</if>
<if test="storageRoom != null and storageRoom != ''">storageRoom</if>, -- 增加逗号
<if test="sn != null and sn != ''">sn,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="batchNumber != null and batchNumber != ''">batchNumber</if>, -- 增加逗号
)values(
<if test="parentPnAssertRukuId != null and parentPnAssertRukuId != ''">#{parentPnAssertRukuId},</if>
<if test="materialInformation != null and materialInformation != ''">#{materialInformation},</if>
<if test="numbersRuKu != null and numbersRuKu != ''">#{numbersRuKu},</if>
<if test="qualified != null and qualified != ''">#{qualified},</if>
<if test="unit != null and unit != ''">#{unit},</if>
<if test="storageRoom != null and storageRoom != ''">#{storageRoom},</if> -- 增加逗号
<if test="sn != null and sn != ''">#{sn},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="batchNumber != null and batchNumber != ''">#{batchNumber},</if> -- 增加逗号
)
</insert>以上就是SQL插入语句报错:缺少逗号导致插入失败的原因是什么?的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号