最近中文字幕高清中文字幕无,亚洲欧美高清一区二区三区,一本色道无码道dvd在线观看 ,一个人看的www免费高清中文字幕

為了賬號安全,請及時綁定郵箱和手機立即綁定

JDBC調(diào)用程序包下的存儲過程,返回結(jié)果集為空

包頭:

CREATE OR REPLACE

PACKAGE PACKAGE1 AS


? type empcursor is ref cursor;

? procedure queryEmpList(dept in number,empList out empcursor);


END PACKAGE1;

包體:

CREATE OR REPLACE

PACKAGE BODY PACKAGE1 AS


? procedure queryEmpList(dept in number,empList out empcursor) AS

? BEGIN

? ? --打開光標

? ? open empList for select * from class_0902 where dept=dept;

? END queryEmpList;


END PACKAGE1;

java:

@Test

public void testCursor() {

String sql = "{call PACKAGE1.queryEmpList(?,?)}";

Connection conn = null;

CallableStatement call = null;

ResultSet rs = null;

try {

conn = JDBCUtils.getConnection();

call = conn.prepareCall(sql);

//賦值輸入?yún)?shù)

call.setInt(1, 10);

//聲明輸出參數(shù)

call.registerOutParameter(2, OracleTypes.CURSOR);

//執(zhí)行調(diào)用

call.execute();

//取出該部門所有員工的信息

rs = ((OracleCallableStatement)call).getCursor(2);

System.out.println(rs.next);

while(rs.next()) {

String name = rs.getString("name");

Double empno = rs.getDouble("emp_no");

Double salary = rs.getDouble("salary");

Double comm = rs.getDouble("comm");

System.out.println(empno + "\t" + name + "\t" + salary + "\t" + comm);

}

} catch (Exception e) {

e.printStackTrace();

}finally{

JDBCUtils.release(conn, call, rs);

}

}

控制臺輸出為false

正在回答

舉報

0/150
提交
取消

JDBC調(diào)用程序包下的存儲過程,返回結(jié)果集為空

我要回答 關(guān)注問題
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號