我有一个oracle存储过程,它在输入参数中包含2个字符串和一个日期,并将ref光标作为输出:
CREATE OR REPLACE PROCEDURE SCHEMA.MYPROSTO ( pPl IN VARCHAR2,-- Comma (;) separated pTy IN VARCHAR2,-- Comma (;) separated pDate IN mytable.mydate%TYPE,pCursor OUT sys_refcursor) IS ..... ssql VARCHAR2 (3000); BEGIN -- making sql Order ssql := 'SELECT TO_CHAR (v.date_c........ ...... OPEN pCursor FOR ssql; END MYPROSTO;
输出游标返回一组3个字符串单元格行.
我在我的实体框架模型中导入了这个存储过程,在.config文件中:
<oracle.manageddataaccess.client> <version number="*"> <implicitRefCursor> <storedProcedure schema="SCHEMA" name="MYPROSTO"> <refCursor name="PCURSOR"> <bindInfo mode="Output"/> <Metadata columnOrdinal="0" columnName="YEAR" providerType="Varchar2" allowDBNull="true" nativeDataType="Varchar2"/> <Metadata columnOrdinal="1" columnName="MONTH" providerType="Varchar2" allowDBNull="true" nativeDataType="Varchar2"/> <Metadata columnOrdinal="2" columnName="COUNT" providerType="Varchar2" allowDBNull="true" nativeDataType="Varchar2"/> </refCursor> </storedProcedure> </implicitRefCursor> </version> </oracle.manageddataaccess.client>
函数import wizzard创建了一个结果对象并生成了一个访问函数:
public virtual ObjectResult<MYPROSTO_Result> MYPROSTO (string pPL,string pTY,Nullable<System.DateTime> pDATE) { var pPLParameter = pPL!= null ? new ObjectParameter("PPL",pPL) : new ObjectParameter("PPL",typeof(string)); var pTYParameter = pTY!= null ? new ObjectParameter("PTY",pTY) : new ObjectParameter("PTY",typeof(string)); var pDATEParameter = pDATE.HasValue ? new ObjectParameter("PDATE",pDATE) : new ObjectParameter("PDATE",typeof(System.DateTime)); return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<MYPROSTO_Result>("MYPROSTO",pPLParameter,pTYParameter,pDATEParameter); }
但是,对此函数的调用会在最后一行引发异常(System.Data.Entity.Core.EntityCommandExecutionException):
ORA-06550: Ligne 1,colonne 8 : PLS-00306: wrong number or types of arguments in call to 'MYPROSTO' ORA-06550: Ligne 1,colonne 8 : PL/sql: Statement ignored
我不明白为什么会失败