【发布时间】:2017-04-28 05:08:40
【问题描述】:
我需要在 c# 中使用 oracle 存储过程。存储过程定义如下:
CREATE OR REPLACE PACKAGE MGRWS10.test_mp
as
type tab_assoc_array is table of varchar2(2000) index by binary_integer;
function f_loten(p_item number) return tab_assoc_array;
procedure p_loten(p_item number, o_result out tab_assoc_array);
end;
/
在c#中我调用了这个过程:
using (var cmd = _connection.CreateCommand()){
OracleParameter stringArray = new OracleParameter();
stringArray.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
stringArray.Direction = ParameterDirection.Output;
stringArray.ParameterName = "o_result";
stringArray.Size = 5;
stringArray.ArrayBindSize = new int[5];
cmd.CommandType = CommandType.StoredProcedure;
cmd.BindByName = true;
cmd.CommandText = "test_mp.p_loten(:p_item, :o_result)";
cmd.Parameters.Add("p_item", 12942);
cmd.Parameters.Add(stringArray);
_connection.Open();
await cmd.ExecuteNonQueryAsync();
var x = (string[]) stringArray.Value;
}
执行 cmd 时,出现以下错误: RA-01008:并非所有变量都绑定
【问题讨论】:
标签: c# .net oracle stored-procedures odp.net