Java调用存储过程结果集为空
包头:
create or replace package pack_test1 is
type userClass is ref cursor;
procedure pro_test1(pkCorp in varchar2,userList out userClass);
end pack_test1;
包体:
create or replace package body pack_test1 is
-- Function and procedure implementations
procedure pro_test1(pkCorp in varchar2,userList out userClass) is
begin
open userList for SELECT * FROM rp_user where corpcode in pkCorp;
end;
end pack_test1;
Java代码:
DBConnection DBConn = new DBConnection();
Connection Conn = DBConn.getConn();
ResultSet rs = null;
String sql = "call pack_test1.pro_test1(?,?)";
CallableStatement call = Conn.prepareCall(sql);
//输入参数赋值
call.setString(1, pk_corps);
//申明输出参数
call.registerOutParameter(2, OracleTypes.CURSOR);
//执行
call.execute();
//取出结果
rs = ((oracle.jdbc.OracleCallableStatement)call).getCursor(2);
while(rs.next()){
UserVo userVo = new UserVo();
userVo.setUnitname(rs.getString("username"));
userVo.setRealname(rs.getString("realname"));
list.add(userVo);
}
不报错,但是结果集没有数据,我确定我表里面是有数据的,麻烦老师帮我看看吧,哪里出错了呀!