2

I am using Entity Framework with Oracle in a project and trying to call a stored procedure from EF. The procedure goes as

Create or Replace Procedure usp_RotaPlateProductie_Select(
    p_afdelingId in varchar2,
    p_productTypeId in varchar2,
    p_productieData out sys_refcursor)
IS 
Begin
    Open p_productieData for
        Select rp.Batchnummer, cppo.Productnummer, p.Omschrijving, pra.Bruto_In_Meters
        From Rotaplateproductie rp inner join Productieresultaatrtplrol pra
        on rp.Batchnummer = pra.Batchnummer inner join Cpiplusproductieorder cppo
        on pra.ProductieNummer = cppo.ProductNummer inner join Product p
        on cppo.Productnummer = p.Productnummer Where rp.Afdelingid = p_afdelingId
        and rp.producttype = p_productTypeId; 
END;

But when EF executes the function I am getting the error below

ORA-06550: line 1, column 8:
PLS-00306: wrong number or types of arguments in call to 'USP_ROTAPLATEPRODUCTIE_SELECT.
ORA-06550: line 1, column 8:
PL / SQL: Statement IGNORED.

I am calling this procedure using the below code

public ObjectResult<RotaPlateProductie> Search_RotaPlateProductie(global::System.String p_AFDELINGID, global::System.String p_PRODUCTTYPEID)
    {
        ObjectParameter p_AFDELINGIDParameter;
        if (p_AFDELINGID != null)
        {
            p_AFDELINGIDParameter = new ObjectParameter("P_AFDELINGID", p_AFDELINGID);
        }
        else
        {
            p_AFDELINGIDParameter = new ObjectParameter("P_AFDELINGID", typeof(global::System.String));
        }

        ObjectParameter p_PRODUCTTYPEIDParameter;
        if (p_PRODUCTTYPEID != null)
        {
            p_PRODUCTTYPEIDParameter = new ObjectParameter("P_PRODUCTTYPEID", p_PRODUCTTYPEID);
        }
        else
        {
            p_PRODUCTTYPEIDParameter = new ObjectParameter("P_PRODUCTTYPEID", typeof(global::System.String));
        }

        return base.ExecuteFunction<RotaPlateProductie>("Search_RotaPlateProductie", p_AFDELINGIDParameter, p_PRODUCTTYPEIDParameter);
    }

Here RotaPlateProductie is the entity from which I am binding the result set Please help.

8
  • how do you call the procedure? the error is saying that you called the procedure with wrong number or type of arguments, and what is the purpose of your procedure? could you give more details? Commented Jun 29, 2012 at 9:47
  • @mcha - Using EF's function import, I pulled out the SP in Model code behind, and using Context.FunctionName I am calling that procedure with the required input params. Let me know if u need more info Commented Jun 29, 2012 at 9:57
  • Please edit your question and add the code which sets up the parameters and calls the stored procedure. Thanks. Also, was this procedure modified and an argument added or removed after your did the import? Commented Jun 29, 2012 at 10:58
  • @BobJarvis - Added the code. Between the procedure was not modified after function import Commented Jun 29, 2012 at 11:04
  • How is your code dealing with the P_PRODUCTIEDATA output parameter? There's no mention of it in the calling code. Commented Jun 29, 2012 at 11:11

1 Answer 1

2

You must add configuration;iIn your case should be as follows:

<oracle.dataaccess.client
    <settings>
      <add name="rp.usp_RotaPlateProductie_Select.RefCursor.p_productieData" value="implicitRefCursor bindinfo='mode=Output'" />...
   <settings>
</oracle.dataaccess.client
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.