0

パッケージ内のストアド プロシージャを呼び出すパラメータとして、ネストされたテーブル ( OracleTable in dotconnection ? ) を渡したいです。タイプ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 の必要なオブジェクトを取得するにはどうすればよいですか? または、この問題は他の方法で解決できますか? どうもありがとう。

4

1 に答える 1

0

パッケージで宣言されたユーザー定義型は、このパッケージの外部では使用できません。OracleTable クラスで使用される型をグローバルに定義してください。

create or replace type test002_type as object(
  -- list here the test002 columns
  c1 number,
  c2 number
);
/
create or replace type test002_table is table of test002_type;
/

JIC: ROWTYPE は PL/SQL コンストラクトであり、SQL create type ステートメントでは認識されません。

于 2014-01-10T13:26:47.567 に答える