c 使用oracle儲存過程獲取結果集例項

2021-04-17 10:50:16 字數 1176 閱讀 3855

儲存過程:

create or replace package firstpage as

/* todo enter package declarations (types, exceptions, methods etc) here */

type v_cursor is ref cursor;

procedure getnumber(re_cursor out v_cursor);

end firstpage;

create or replace package body firstpage as

procedure getnumber(re_cursor out v_cursor) as

begin

/* todo implementation required */

open re_cursor for

select * from testable;

end getnumber;

end firstpage;

c#**:

public dataset gettablebyprocedure()

{oracleconnection con = new oracleconnection(_connectionstring);

oraclecommand cmd = new oraclecommand();

cmd.connection = con;

cmd.commandtype = commandtype.storedprocedure;

cmd.commandtext = "firstpage.getnumber";

oracleparameter sp = new oracleparameter("re_cursor", oracletype.cursor);

sp.direction = parameterdirection.output;

cmd.parameters.add(sp);

oracledataadapter da = new oracledataadapter(cmd);

dataset ds = new dataset();

da.fill(ds);

cmd.dispose();

con.close();

con.dispose();

return ds;

C 中使用Oracle 儲存過程筆記

c 中使用oracle 儲存過程筆記 1.呼叫包含out in out型別引數的儲存過程 儲存過程 flag out integer out 只具備輸出功能 in out 為輸入 輸出型 呼叫方法 oracleparameter retpar new oracleparameter channeli...

oracle儲存過程 cursor使用

create or replace procedure test is v count number 4 cursor v c is select from t2voucherhandno begin select count into v count from t2voucherhandno if...

使用oracle儲存過程分頁

1.首先在oracle中建儲存過程,儲存過程名庫 procedure prc query create or replace procedure prc query p tablename in varchar2,表名 p strwhere in varchar2,查詢條件 p ordercolum...