I am trying to pass an integer array to Oracle stored procedure.
following type defined in Oracle.
CREATE OR REPLACE TYPE EMPIDLIST
AS TABLE OF Number;
following is the stored proc that is using the above type.
CREATE OR REPLACE PROCEDURE TESTINPUTARRAY
(
IN_STR_ARRAY IN EMPIDLIST
) AS
BEGIN
--Doing something here.....
NULL;
END TESTINPUTARRAY;
following is the code to call the stored proc from .net application using Dapper ORM.
List<int> values = new List<int>() { 1, 2, 3, 4, 5 };
OracleParameter parameters = new OracleParameter
{
ParameterName = "IN_STR_ARRAY",
OracleDbType = OracleDbType.Int32,
Value = values.ToArray(),
Direction = System.Data.ParameterDirection.Input
};
await connection.ExecuteAsync("TESTINPUTARRAY", param: parameters, commandType: CommandType.StoredProcedure);
When the above ExecuteAync method is called, I get following error-
Unable to cast object of type 'System.Int32[]' to type 'System.IConvertible
I searched online about this issue, but could not find any solution.