日期:2014-05-16  浏览次数:20451 次

JDBC调用有返回值和结果集的mssql存储过程
String sql = "{ ?=call Pro_Test(?) }";
Connection conn = getConnection();
CallableStatement call = conn.prepareCall(sql);
call.registerOutParameter(1, java.sql.Types.INTEGER);
call.setObject(2, "参数");
call.execute();

// 获取结果集
ResultSet resultSet = call.getResultSet();

// 获取返回值
call.getMoreResults();
int returnValue = call.getInt(1);