Oracle存储过程调用返回异常ORA-06550和PLS-00103

时间:2012-03-26 22:56:23

标签: oracle entity-framework stored-procedures oracle11g ora-06550

我正在尝试通过Entity Framework数据上下文执行Oracle存储过程。我的存储过程如下所示:

PROCEDURE "GET_SUPPLIERS" (
    SUPP_LIST OUT SYS_REFCURSOR) AS
BEGIN 

    OPEN SUPP_LIST FOR 
    SELECT 
        SUPPLIER_NAME 
    FROM 
        A_SUPPLIER  ;

END;

App.config设置:

  <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>

我按如下方式调用代码:

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

并在以下行中:

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

我收到以下异常

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>

1 个答案:

答案 0 :(得分:1)

尝试将您的名称参数更新为

  

SYSADM.GET_SUPPLIERS.RefCursor.SUPP_LIST

  

SYSADM.GET_SUPPLIERS.RefCursorMetaData.SUPP_LIST.Column.0

实体框架始终使用BindByName来运行存储过程(而不是参数的位置表示法)。