Skip to Main Content

ODP.NET

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Unexpected Packet received in Oracle.ManagedDataAccessCore (2.19.80)

4252326Jul 29 2020 — edited Aug 19 2020

Envrioment

  • Platform: .NET Core 3.1 Console Application
  • Oracle Nuget: Oracle.ManagedDataAccessCore (2.19.80)

Steps

  1. Create a table with a DateTime column named "CreateDate".
  2. Execute the following query:

select

(

        CASE

            WHEN 1 = 0 THEN a."CreateDate"

            ELSE NULL

        END

    ) as C0

from

    "YourTableName" a

Exception

System.Exception: 'TTCExecuteSql:ReceiveExecuteResponse - Unexpected Packet received.'

This exception was originally thrown at this call stack:

    OracleInternal.TTC.TTCExecuteSql.ReceiveExecuteResponse(ref OracleInternal.TTC.Accessors.Accessor[], OracleInternal.TTC.Accessors.Accessor[], bool, ref OracleInternal.Common.SQLMetaData, OracleInternal.Common.SqlStatementType, long, int, out int, ref long, int, long, long[], bool, int, ref OracleInternal.ServiceObjects.DataUnmarshaller, ref OracleInternal.TTC.TTCExecuteSql.MarshalBindParameterValueHelper, out long[], bool, ref bool, ref System.Collections.Generic.List<OracleInternal.TTC.Accessors.TTCResultSet>, bool)

    OracleInternal.ServiceObjects.OracleDataReaderImpl.FetchMoreRows(int, bool, bool)

    Oracle.ManagedDataAccess.Client.OracleDataReader.Read()

    System.Data.Common.DataAdapter.FillLoadDataRow(System.Data.ProviderBase.SchemaMapping)

    System.Data.Common.DataAdapter.FillFromReader(System.Data.DataSet, System.Data.DataTable, string, System.Data.ProviderBase.DataReaderContainer, int, int, System.Data.DataColumn, object)

    System.Data.Common.DataAdapter.Fill(System.Data.DataTable[], System.Data.IDataReader, int, int)

    Oracle.ManagedDataAccess.Client.OracleDataAdapter.Fill(System.Data.DataTable[], int, int, System.Data.IDbCommand, System.Data.CommandBehavior)

    System.Data.Common.DbDataAdapter.Fill(System.Data.DataTable)

    OracleTest.Program.Main(string[]) in Program.cs

Example

    class Program

    {

        static void Main(string[] args)

        {

            var connectionStr = @"YOUR CONNECTION STRING";

            var oracleConnection = new OracleConnection(connectionStr);

            oracleConnection.Open();

            var sql = $"select(CASE WHEN 1 = 0 THEN a.\"Date\" ELSE NULL END) as C0 from \"YOUR TABLE NAME\" a ";

            using (var command = oracleConnection.CreateCommand())

            {

                command.CommandText = sql;

                DataTable dataTable = new DataTable();

                using (var adapter = new OracleDataAdapter())

                {

                    adapter.SelectCommand = command;

                    adapter.Fill(dataTable);

                }

            }

        }

    }

This post has been answered by Alex Keh-Oracle on Aug 19 2020
Jump to Answer

Comments

Alex Keh-Oracle

I tried your C# app with a table using a DATE column and TIMESTAMP column. In both cases with either ODP.NET Core 2.19.80 or 2.19.70, I didn't hit an error. I used DB 19c. Which DB version did you use?

4252326

I found out that there must be at least one record in the table. For example:

Table Design:

Name
Type
Size
IDNumber0
DateDATE7
TimeTIMESTAMP0
Time2INTERVAL DAY TO SECOND0

Table Data:

ID
DateTimeTime2
1(Null)(Null)(Null)

Then replace the [column] in the sql below:

var sql = $"select(CASE WHEN 1 = 0 THEN a.\"[column]\" ELSE NULL END) as C0 from \"YOUR TABLE NAME\" a ";

 

[Date]: reproduced

[Time]: can't reproduce

[Time2]: reproduced

DB version: 11/12/18/19c

Alex Keh-Oracle

I added the interval column and added one row of data, but still can't reproduce the problem with the 2.19.80 version against the data or interval column. Do you want to send us your trace? Just add these two lines and run your app.

OracleConfiguration.TraceFileLocation = @"D:\traces";

OracleConfiguration.TraceLevel = 7;

You can send the trace file to dotnet_us (at) oracle.com.

4252326

Thank you. The email has been sent. I hope it's useful to you.

Alex Keh-Oracle

This bug appears to be the same as Bug 26123054.

4252326

Will this problem be fixed recently?

Alex Keh-Oracle

The bug hasn't been fixed yet. We're still evaluating the root cause.

Alex Keh-Oracle
Answer

The bug has been fixed in our main code line. My expectation is that the fix will be in the ODP.NET Core 19.10 release.

Marked as Answer by 4252326 · Sep 27 2020
1 - 8

Post Details

Added on Jul 29 2020
8 comments
2,370 views