1

This was my attempt:

cmd.CommandType = CommandType.StoredProcedure;

cmd.Parameters.Add("i_num_array_price_list", OracleDbType.Decimal, myItems.Select(c => c.Price).ToArray(), ParameterDirection.Input);

In oracle, the type is declared as:

i_num_array_price_list IN num_array,

and that is defined as:

TYPE Num_Array IS VARRAY(10) OF NUMBER;

I've tried it as OracleDbType decimal and array, neither worked. Decimal produces this error:

Unable to cast object of type 'System.Decimal[]' to type 'System.IConvertible'.

Any idea how I can get it to accept my array of decimal values?

4

1 回答 1

0

我找不到使用上述数组定义来完成这项工作的任何方法,因此我将其更改为关联数组并使用以下代码:

要定义我的数组: TYPE assoc_array_number_t IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;

要定义我的变量: i_num_array_price_list IN assoc_array_number_t

和我的 C# 代码:

cmd.Parameters.Add("i_num_array_price_list", OracleDbType.Decimal, myItems.Select(c => c.Price).ToArray(), ParameterDirection.Input).CollectionType = OracleCollectionType.PLSQLAssociativeArray;

于 2012-10-22T21:38:48.660 回答