Nilesh Bawalekar
Nilesh Bawalekar

Reputation: 21

PLS-00306: wrong number or types of arguments in .NET Entity Framework

I am using Oracle 11 g with EDM (using ODP.net). My Oracle SP returns a Ref Cursor and I am not able to run it from EDM. I have created a complex type and added function import for the SP selecting the return value as the complex type.

Once I run my application, I get the following error:

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

My App.config :

add name="SYSTEM.GetScriptDetail.RefCursor.cv_1" value="implicitRefCursor bindinfo='mode=Output'" 

add name="SYSTEM.GetScriptDetailbyAITID.RefCursorMetaData.cv_1.Column.0" value="implicitRefCursor metadata='ColumnName=TITLE;BaseColumnName=TITLE;NATIVEDATATYPE=Varchar2;ProviderType=Varchar2'"

My Function Import contains :

    public ObjectResult<GETSCRIPTDETAIL_Result> GETSCRIPTDETAIL(Nullable<global::System.Decimal> v_ID)
    {
        ObjectParameter v_IDParameter;
        if (v_ID.HasValue)
        {
            v_IDParameter = new ObjectParameter("V_ID", v_ID);
        }
        else
        {
            v_IDParameter = new ObjectParameter("V_ID", typeof(global::System.Decimal));
        }

        return base.ExecuteFunction<GETSCRIPTDETAIL_Result>("GETSCRIPTDETAIL", v_IDParameter);
    }

It thorwing exception from "return base.ExecuteFunction("GETSCRIPTDETAIL", v_IDParameter);

My Oracle SP Parameter as: v_ID IN NUMBER DEFAULT NULL ,

 cv_1 OUT SYS_REFCURSOR 

How can i pass refcursor output to executefuction as paramter ? or Do i required to pass this paramter ?

Upvotes: 2

Views: 2007

Answers (1)

Thomas K.
Thomas K.

Reputation: 23

You need to add the following in your .config file

<oracle.manageddataaccess.client>
  <version number="*">
    <implicitRefCursor>
      <storedProcedure schema="schemaname" name="GETSCRIPTDETAIL">
        <refCursor name="CV_1">
          <bindInfo mode="Output" />
        </refCursor>
      </storedProcedure>
    </implicitRefCursor>
  </version>
</oracle.manageddataaccess.client>

I've found the steps here where you can do that semi automatically in VS directly: http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/12c/r1/appdev/dotnet/EntityFrameworkOBE/EntityFrameworkOBE.html#section5

Now my problems are with the schema name being everywhere in the configuration and edmx, and I haven't found a decent way to make it dynamic.

Upvotes: 2

Related Questions