Question

I am trying to execute an Oracle stored proc via an Entity Framework data context. My stored procedure looks as follows:

PROCEDURE "GET_SUPPLIERS" (
    SUPP_LIST OUT SYS_REFCURSOR) AS
BEGIN 

    OPEN SUPP_LIST FOR 
    SELECT 
        SUPPLIER_NAME 
    FROM 
        A_SUPPLIER  ;

END;

The App.config settings:

  <oracle.dataaccess.client>
    <settings>
      <add name="SYSADM.GET_SUPPLIERS.RefCursor.0" value="implicitRefCursor bindinfo='mode=Output'" />


      <add name="SYSADM.GET_SUPPLIERS.RefCursorMetaData.0.Column.0"
           value="implicitRefCursor metadata='ColumnName=SUPPLIER_NAME;
           BaseColumnName=SUPPLIER_NAME;BaseSchemaName=SYSADM;BaseTableName=A_SUPPLIER;
           NativeDataType=varchar2;ProviderType=Varchar2;
           ProviderDBType=String;DataType=System.String;
           ColumnSize=10;AllowDBNull=true'" />


    </settings>
  </oracle.dataaccess.client>

I invoke the code as follows:

    var ctx = new Supplier.SupplierEntities();
    Supplier.GET_SUPPLIERS_Result1 r = ctx.GET_SUPPLIERS().FirstOrDefault();

and on the following line:

public ObjectResult<GET_SUPPLIERS_Result1> GET_SUPPLIERS()
{
    return base.ExecuteFunction<GET_SUPPLIERS_Result1>("GET_SUPPLIERS");
}

I get the following exception

ORA-06550: line 1, column 32:
PLS-00103: Encountered the symbol ">" when expecting one of the following:

   ( ) - + case mod new not null <an identifier>
   <a double-quoted delimited-identifier> <a bind variable>
   table continue avg count current exists max min prior sql
   stddev sum variance execute multiset the both leading
   trailing forall merge year month day hour minute second
   timezone_hour timezone_minute timezone_region timezone_abbr
   time timestamp interval date
   <a string literal with character set specification>
Était-ce utile?

La solution

Try updating your name parameters to

SYSADM.GET_SUPPLIERS.RefCursor.SUPP_LIST

and

SYSADM.GET_SUPPLIERS.RefCursorMetaData.SUPP_LIST.Column.0

Entity Framework always uses BindByName to run stored procedures (rather than the positional notation for parameters).

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top