List<Object[]> result = new ArrayList<Object[]>();//接收值所用的列表
Connection conn = DAOFactory.getDAOFactory().getConnection();//根据项目情况打开连接(这里只是我项目的打开方式)
CallableStatement statement = conn.prepareCall("{call up_GetDept(?)}");//执行存储过程"?"为需传递的参数
statement.setString(1, productCode);//传递参数
ResultSet rs = statement.executeQuery();
//循环拿出返回的值
while (rs.next()) {
Object[] object = new Object[2];
object[0] = rs.getString("deptname");
object[1] = rs.getString("deptcode");
result.add(object);
}
conn.commit();
JAVA执行存储过程接收返回值
最新推荐文章于 2022-05-03 12:21:26 发布