我正试图通过实体框架数据上下文执行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>
尝试将您的名称参数更新为
SYSADM.GET_SUPPLIERS.RefCursor.SUPP_LIST
和
SYSADM.GET_SUPPLIERS.RefCursorMetaData.SUPP_LIST.Column.0
实体框架总是使用BindByName来运行存储过程(而不是参数的位置表示法)。