Unexpected Packet received in Oracle.ManagedDataAccessCore (2.19.80) — oracle-tech

    Forum Stats

  • 3,715,484 Users
  • 2,242,774 Discussions
  • 7,845,364 Comments

Discussions

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Unexpected Packet received in Oracle.ManagedDataAccessCore (2.19.80)

4252326
4252326 Member Posts: 7
edited August 2020 in ODP.NET

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 C0from    "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);                }            }        }    }
4252326

Best Answer

Answers

Sign In or Register to comment.