错误:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server vers

错误:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘’ at line 1

今天在运行项目的时候报了一个关于sql的错误:
错误:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server vers

关于这种错误,首先就要去查看自己的sql语句是否正确

问题排查:

这是原来的代码,发现sql语句竟然多写了一个逗号。

@Override
    public int delete(int oOrderNum) {
        String sql = "delete from allOrders where oOrderNumber=?,";
        return template.update(sql,oOrderNum);
    }

解决方案:

把逗号删除后就解决并完美运行了。

@Override
    public int delete(int oOrderNum) {
        String sql = "delete from allOrders where oOrderNumber=?";
        return template.update(sql,oOrderNum);
    }

功能完美运行:

错误:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server vers
错误:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server vers

上一篇:改环境变量改出问题了,vi,ls这些命令都不能用了,怎么办


下一篇:java – 无限循环应用程序 – for(;;)