0

Doing exactly the same in this LINK

I am trying to call an Oracle procedure/package using Entity Framework. But I am getting a different error than the one mentioned in the link.

Code

public List<ClearTypes> GetOffices()
{
     var param1 = new OracleParameter("P_CUR", OracleDbType.RefCursor, ParameterDirection.Output);           
     var ATests = this.Database.SqlQuery<ClearTypes>("BEGIN PRC_GET_CLEAR(:P_CUR); end;", param1).ToList();            
     return ATests;
}

SQL query:

BEGIN
    OPEN P_CUR FOR

    SELECT ID, Name FROM ClearType;

END

ClearType class:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace MVCApp2.Models
{
    public class ClearTypes
    {
       public int ID{get;set;}
       public string Name{ get; set; }
    }
}

The error what I get when running the application is:

An exception of type 'System.ArgumentException' occurred in System.Data.Entity.dll but was not handled in user code

Additional information: Value does not fall within the expected range.

What might be the reason for this?

Community
  • 1
  • 1
smilu
  • 859
  • 7
  • 30
  • 53

1 Answers1

1

This will work if you add Oracle managed data access package from Nuget packages in Visual studio.

using OracleParameter from Oracle.ManagedDataAccess.Client; will not throw error.

smilu
  • 859
  • 7
  • 30
  • 53