第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

JDBC調(diào)用程序包下的存儲(chǔ)過程,返回結(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

? ? --打開光標(biāo)

? ? 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);

}

}

控制臺(tái)輸出為false

正在回答

舉報(bào)

0/150
提交
取消

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

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

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

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

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