Excuse me if question is being repeated. I have two projects in my solution, a console application and a MVC4 website. I'm using Oracle managed drviers for accessing oracle database 11g. I'm trying to retrieve data from following stored procedure:
create or replace procedure "GETEMPIDS"
(
p_cursor OUT SYS_REFCURSOR
)
is
begin
OPEN p_cursor FOR
select *
from EMP;
end;
After making entities and other stuff in my console application, I get data by doing:
public List<GETEMPIDS_Result> GetAllEmployees()
{
Entities db = new Entities();
List<GETEMPIDS_Result> result = db.GETEMPIDS().ToList<GETEMPIDS_Result>();
return result;
}
I have added reference of this console application in my website but when I call above method in my controller it gives exception:
"ORA-06550: line 1, column 8:\nPLS-00306: wrong number or types of arguments in call to 'GETEMPIDS'\nORA-06550: line 1, column 8:\nPL/SQL: Statement ignored"}
at following line in context class
public virtual System.Data.Entity.Core.Objects.ObjectResult<GETEMPIDS_Result> GETEMPIDS()
{
return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<GETEMPIDS_Result>("GETEMPIDS");
}
Is there anything I'm missing?
Your procedure
GETEMPIDS
acceptsp_cursor OUT SYS_REFCURSOR
as a parameter. Apparently, you have to declare a ResultSet and pass it to the procedure. Like this:Oops, ResultSet is for Java, I didn't notice C# in the tags. Anyway, I hope you get the idea.
When we add a result of Stored Procedure in entities, it adds some code relating to output fields in config file.
My problem was solved when I copied that code and pasted it in config file of my website.