存储过程包定义如下:
CREATE OR REPLACE PACKAGE JXZLPJ
IS
type arr is table of integer index by binary_integer;
procedure ceshi(reccount out int,v_arr out arr);
END JXZLPJ;
CREATE OR REPLACE PACKAGE BODY JXZLPJ
IS
procedure ceshi(reccount out int,v_arr out arr)
is
cursor temp_xh is select xh from xj_xjb where xh like '19222%';
temp_jj varchar2(10);
i integer;
begin
i:=0;
select count(*) into reccount from xj_xjb where xh like '19222%';
open temp_xh;
loop
fetch temp_xh into temp_jj;
v_arr(i):=temp_jj;
i:=i+1;
end loop;
close temp_xh;
end;
END JXZLPJ;
在 c#中 如何调用输出为table型的 过程 ?
我这儿是举的一个例子,实际应用中是要计算一个员工的不同指标对应的总分数,由于每个员工对应的指标可能不一样,多少可能不一样 ,因此才想到用数组形势存储值.
c#过程的定义:
public void ceshishuzu()
{
int i;
OracleCommand oracmd = new OracleCommand();
OracleConnection conn = new OracleConnection(ConStr);
oracmd.Connection = conn;
oracmd.CommandText = "jxzlpj.ceshi";
oracmd.CommandType = CommandType.StoredProcedure;
oracmd.Parameters.Add("reccount",OracleType.Int16).Direction=ParameterDirection.Output;
//输出值reccount
oracmd.Parameters.Add("v_arr", OracleType.?).Direction = ParameterDirection.Output;
//c#中的 oracletype没有table这个类型,我应该如何得到oracle存储过程中v_arr out arr的值?
}
请指点,谢谢!
CREATE OR REPLACE PACKAGE JXZLPJ
IS
type arr is table of integer index by binary_integer;
procedure ceshi(reccount out int,v_arr out arr);
END JXZLPJ;
CREATE OR REPLACE PACKAGE BODY JXZLPJ
IS
procedure ceshi(reccount out int,v_arr out arr)
is
cursor temp_xh is select xh from xj_xjb where xh like '19222%';
temp_jj varchar2(10);
i integer;
begin
i:=0;
select count(*) into reccount from xj_xjb where xh like '19222%';
open temp_xh;
loop
fetch temp_xh into temp_jj;
v_arr(i):=temp_jj;
i:=i+1;
end loop;
close temp_xh;
end;
END JXZLPJ;
在 c#中 如何调用输出为table型的 过程 ?
我这儿是举的一个例子,实际应用中是要计算一个员工的不同指标对应的总分数,由于每个员工对应的指标可能不一样,多少可能不一样 ,因此才想到用数组形势存储值.
c#过程的定义:
public void ceshishuzu()
{
int i;
OracleCommand oracmd = new OracleCommand();
OracleConnection conn = new OracleConnection(ConStr);
oracmd.Connection = conn;
oracmd.CommandText = "jxzlpj.ceshi";
oracmd.CommandType = CommandType.StoredProcedure;
oracmd.Parameters.Add("reccount",OracleType.Int16).Direction=ParameterDirection.Output;
//输出值reccount
oracmd.Parameters.Add("v_arr", OracleType.?).Direction = ParameterDirection.Output;
//c#中的 oracletype没有table这个类型,我应该如何得到oracle存储过程中v_arr out arr的值?
}
请指点,谢谢!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货