com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:

时间:2018-09-24 10:01:51

标签: java sql spring spring-boot stored-procedures

使用可调用语句调用存储过程时,出现此错误。

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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 'NULL' at line 1

我的代码:

            Connection connection = jdbcTemplate.getDataSource().getConnection();
            CallableStatement callableStatement = connection.prepareCall("{call FILE_REPORT(?, ?, ?, ?, ?, ?, ?, ?, ?)}");
            java.sql.Date startDate = new java.sql.Date(fileStatusReportRequest.getFromDate().getTime());
            callableStatement.setString(1, "2018-09-24");
            callableStatement.setString(2, "2017-09-24");

            callableStatement.setInt(3, offsetValue);
            callableStatement.setInt(4, fileStatusReportRequest.getSize());

            callableStatement.setString(5, "abc");
            callableStatement.setInt(6,  0);

            callableStatement.setInt(7, 0);
            callableStatement.setInt(8, 0);

            callableStatement.setInt(9, 0);

            callableStatement.execute();

每次我在 callableStatement.execute(); 行出现错误。

在存储过程端,我是从弹簧端获取此参数的。

FILE_REPORT (IN fromDate DATE, IN toDate DATE, IN offset INT, IN limit INT, IN list VARCHAR(50), IN cId INT, IN aId INT, IN afeId INT, IN assiId INT)

0 个答案:

没有答案