我想传递一个嵌套表(点连接中的 OracleTable ?)作为参数来调用包中的存储过程。类型test002_table在包中定义。存储过程代码如下:
create or replace package testPro is
type test002_table is table of test002%rowtype;
procedure testInsert(tbs test002_table);
end testPro;
create or replace package body testPro is
procedure testInsert(tbs test002_table) is
i int;
begin
delete from test002;
for i in 1..tbs.count loop
insert into test002 values tbs(i);
end loop;
end;
end;
用 PL\SQL 编写的测试成功运行:
declare
tab testpro.test002_table := testpro.test002_table();
item test002%rowtype;
i integer;
begin
tab.extend();
item.id:=1;
item.name:='a';
item.lev:=5;
item.age:=55;
item.address:='das';
tab(tab.count) := item;
testPro.testInsert(tab);
commit;
end;
但我不知道如何使用 dotConnect 调用此过程。我尝试了以下方法但没有成功:
OracleCommand cmd = new OracleCommand();
cmd.Connection = con; //OracleConnection con
cmd.CommandType = System.Data.CommandType.StoredProcedure;
OracleType tp = OracleType.GetObjectType("testPro.test002_table", con);
OracleTable table = new OracleTable(tp);
Dotconnect 找不到类型。如何获得所需的 OracleType 对象?或者这个问题可以通过其他方式解决吗?非常感谢。