Pass Empty PL/Sql Table to procedure
Posted: Tue 03 Jul 2012 09:24
Hello,
I'm trying to send through a procedure an empty Pl/Sql Table but I don't know how to do it. I tried to put the ArrayLength to 0 and Value to an empty .Net Array (not null) but I have this error (The error occur in direct and client mode.):
With this stack:
Here is the source code I use to reproduce the exception :
Oracle:
.Net
I read the doc(http://www.devart.com/dotconnect/oracle ... ength.html) but it does not explain how to manipulate empty pl/sql table
Can you explain me how can I achieve this ?
Thanks in advance.
I'm trying to send through a procedure an empty Pl/Sql Table but I don't know how to do it. I tried to put the ArrayLength to 0 and Value to an empty .Net Array (not null) but I have this error (The error occur in direct and client mode.):
Code: Select all
Test method Devart.dotConnect.TestProject.PLSQLTableTest.PLSQLTableEmpty_Direct threw exception:
System.InvalidCastException: Unable to cast object of type 'System.Decimal[]' to type 'System.IConvertible'.
Code: Select all
System.Convert.ToDecimal(Object value)
Devart.Data.Oracle.OracleParameter.a(OracleDbType A_0, Object A_1, Object A_2, Byte[] A_3, Hashtable A_4, Int32 A_5, Int32 A_6, Int32 A_7, Int32 A_8, Int32 A_9, Boolean A_10, OracleConnection A_11, ParameterDirection A_12, OracleType A_13, am A_14, Boolean& A_15)
Devart.Data.Oracle.OracleParameter.a(bb& A_0, Boolean A_1, OracleConnection A_2, Byte[] A_3, Hashtable A_4, am A_5, Boolean& A_6, Int32 A_7)
Devart.Data.Oracle.OracleCommand.a(ak A_0, Int32 A_1, OracleParameterCollection A_2, am A_3, Boolean& A_4)
Devart.Data.Oracle.OracleCommand.InternalExecute(CommandBehavior behavior, IDisposable disposable, Int32 startRecord, Int32 maxRecords, Boolean nonQuery)
Devart.Common.DbCommandBase.ExecuteDbDataReader(CommandBehavior behavior, Boolean nonQuery)
Devart.Data.Oracle.OracleCommand.ExecuteNonQuery()
Devart.dotConnect.TestProject.PLSQLTableTest.PLSQLTableEmpty(OracleConnection connection) in D:\Sources\Web\Tests Devart MT\DevartDotConnectOracle-trunk\src\Devart.dotConnect.TestProject\PLSQLTableTest.cs: line 54
Devart.dotConnect.TestProject.PLSQLTableTest.PLSQLTableEmpty_Direct() in D:\Sources\Web\Tests Devart MT\DevartDotConnectOracle-trunk\src\Devart.dotConnect.TestProject\PLSQLTableTest.cs: line 32
Oracle:
Code: Select all
Create or Replace Function EmptyPlSqlTable
(
tab_in In dbms_sql.Number_Table,
x In number
)
Return Number
Is
Begin
Return tab_in.Count;
End EmptyPlSqlTable;
/
Code: Select all
private void PLSQLTableEmpty(OracleConnection connection)
{
decimal[] tab = new decimal[] {};
using (var cmd = connection.CreateCommand())
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.ParameterCheck = true;
cmd.CommandText = "EmptyPlSqlTable";
cmd.Prepare();
cmd.Parameters["X"].Value = 42;
cmd.Parameters["TAB_IN"].Value = tab;
cmd.Parameters["TAB_IN"].ArrayLength = tab.Length;
cmd.ExecuteNonQuery();
}
}
I read the doc(http://www.devart.com/dotconnect/oracle ... ength.html) but it does not explain how to manipulate empty pl/sql table
Can you explain me how can I achieve this ?
Thanks in advance.