我试着在下面的类中调用存储过程导致“ORA-00911:无效字符”,但我找不到无效字符的位置,所有事情对我来说都很好,因为我按照存储过程示例。
public Info inquireData(String str)
{
Info result = new QuotaInfo();
Connection con = null;
CallableStatement callableStatement = null;
try {
con = (Connection) getEntityManager().unwrap(Connection.class);
callableStatement = con.prepareCall("{ call WEB_DATA_INQUIRY(?,?,?,?,?,?) }");
result = new Info();
callableStatement.setString(1, str);
callableStatement.registerOutParameter(2, Types.NUMERIC);
callableStatement.registerOutParameter(3, Types.NUMERIC);
callableStatement.registerOutParameter(4, Types.DATE);
callableStatement.registerOutParameter(5, Types.NUMERIC);
callableStatement.registerOutParameter(6, Types.VARCHAR);
callableStatement.execute();
result.setTotalNumber(callableStatement.getInt(2));
result.setConsumedNumber(callableStatement.getInt(3));
Date expiryDate = callableStatement.getDate(4);
if (expiryDate != null) {
result.setExpiryDate(new java.util.Date(expiryDate.getTime()));
}
} catch (SQLException e) {
throw new DBException(e);
}
return result;
}
当我运行程序时,异常显示如下:
com.walsa.web.dalayer.exception.DBException: java.sql.SQLSyntaxErrorException: ORA-00911: invalid character
ORA-06512: at "WALSA.WEB_DATA_INQUIRY", line 12
ORA-06512: at line 1
答案 0 :(得分:0)
过了一会儿,我们发现java代码正确连接到该存储过程。问题出在存储过程本身内。