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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

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

Post Details

Added on Jul 29 2020
8 comments
2,342 views