We're running into a strange error using Oracle Odp.Net (connecting to Oracle 9). The problem is illustrated by the code snippet below.
This is the error we're experiencing:
ORA-00600: internal error code, arguments: [15419], [severe error during PL/SQL execution], [], [], [], [], [], []
ORA-06544: PL/SQL: internal error, arguments: [78502], [], [], [], [], [], [], []
ORA-06553: PLS-801: internal error [78502]
Googling around makes us suspect (though we're not entirely sure) that passing an array of Timestamps is not supported by Odp.Net.
So the question is 2-fold:
- is it possible to pass an array of timestamp to a pl/sql procedure using odp.net?
- if not, is there a good workaround available?
C# console program illustrating the problem:
using System;
using System.Collections;
using System.Data;
using Oracle.DataAccess.Client;
class Program
{
private const string _db = "<db>";
private const string _username = "<user>";
private const string _password = "<password>";
private const string _storedProcedureName = "<sproc>";
static void Main(string[] args)
{
var connectionString = string.Format(
"data source={0};user id={1};password={2}",
_db, _username, _password);
var connection = new OracleConnection(connectionString);
try
{
connection.Open();
var timeStamps = new[] { DateTime.Now, DateTime.Now };
var parameter = new OracleParameter("inTimeStamps", OracleDbType.TimeStamp)
{
Direction = ParameterDirection.Input,
CollectionType = OracleCollectionType.PLSQLAssociativeArray,
Size = timeStamps.Length,
Value = timeStamps
};
var command = connection.CreateCommand();
command.CommandType = CommandType.StoredProcedure;
command.CommandText = _storedProcedureName;
command.Parameters.Add(parameter);
command.ExecuteReader();
}
finally
{
connection.Close();
}
}
}
The code is calling the following PL/SQL stored procedure
TYPE ArrayOfTimestamps is table of timestamp index by binary_integer;
PROCEDURE TestOdpTimeStamp (inTimeStamps in ArrayOfTimestamps)
IS
test number;
BEGIN
select 1 into test from dual;
END;
You can pass a nested table of timestamps instead of an associative array to a PL/SQL procedure.
You need odp.net 11.1.0.6.20 or higher, you can connect with odp.net 11.1.0.6.20 to an Oracle 9 server.
Execute as Oracle user testts:
In C#, create a form with a button called button1, and do...
Do in Oracle...