為什么我取不出結果,就是控制臺上沒有打印任何東西,也沒有出什么錯。代碼貼上:create or replace package mypackage as????type empcursor is ref cursor;????procedure queryemplist(dno in number,emplist out empcursor);end mypackage;create or replace package body mypackage as????procedure queryemplist(dno in number,emplist out empcursor) asbegin??? open emplist for select * from emp where empno=dno;??? end queryemplist; end mypackage;--------------------------------------------------------------------------------------------public static void main(String[] args) {?? ??? ?Connection conn = null;?? ??? ?CallableStatement call = null;?? ??? ?ResultSet rs = null;?? ??? ?try {?? ??? ??? ?String sql = "{call MYPACKAGE.queryemplist(?,?)}";?? ??? ??? ?conn? = JDBCUtil.getConn();?? ??? ??? ?call = conn.prepareCall(sql);?? ??? ??? ?call.setInt(1, 20);?? ??? ??? ?call.registerOutParameter(2,OracleTypes.CURSOR);?? ??? ??? ?call.execute();?? ??? ??? ?rs = ((OracleCallableStatement)call).getCursor(2);?? ??? ??? ?//rs = (ResultSet) call.getObject(2);?? ??? ??? ?while(rs.next()){?? ??? ??? ??? ?int deptno = rs.getInt("deptno");?? ??? ??? ??? ?String name = rs.getString("ename");?? ??? ??? ??? ?String job = rs.getString("job");?? ??? ??? ??? ?double salary = rs.getDouble("sal");?? ??? ??? ??? ?System.out.println(deptno+"\t"+name+"\t"+job+"\t"+salary);?? ??? ??? ?}?? ??? ?} catch (Exception e) {?? ??? ??? ?e.printStackTrace();?? ??? ?}?? ?}
添加回答
舉報
0/150
提交
取消