我有一个返回一个输出参数的 SQL Server 2008 过程,我从 java 调用它。我的代码如下
存储过程代码是
Create PROCEDURE countInfected @infected int out
AS
Select @infected = COUNT(*) from userInfo
where userID NOT IN (Select userID from deletedInfo);
Java 调用代码是
CallableStatement infected = null;
infected = con.prepareCall("call countInfected(?)");
infected.registerOutParameter(1, java.sql.Types.INTEGER);
infected.execute();
System.out.println("Infected"+ infected.getInt(1));
但感染了.execute(); 正在生成以下错误
com.microsoft.sqlserver.jdbc.SQLServerException:'@P0' 附近的语法不正确
请指导我哪里有问题