简体   繁体   中英

Populate dataset using stored procedure with Oracle 12c client fails

I have inherited a C# application which uses Executedataset method to populate a dataset from an Oracle 11g DB. The stored procedure is a part of a PL/SQL package and currently has 3 OUT cursors . I use Oracle 11g client on all the client machines. We have a need to use Oracle 12c client going forward. However, after I installed Oracle 12c, the ExecuteDataset method fails with the exception " number of parameters does not match number of values for stored procedure ". On my research I found that I would have to use only one OUT CURSOR . I also tried doing that and with that although the Stored proc returns data as seen through the SQL developer debug session, I am not able to return that in my application.

Below is my simple call that works to get data with Oracle 11g:

    DataSet ds = DB.ExecuteDataSet("MY_PKG.GET_VALUES", Month,Yr, 
                                   null,null,null);

null values are for OUT REF cursors

Below is the original Stored procedure definition:

    PROCEDURE GET_VALUES (
     PI_MONTH IN MDETAIL.MONTH%TYPE,
     PI_YR IN MDETAIL.YR%TYPE,
     CUR_OUT1 IN OUT MY_PKG.refcur,
     CUR_OUT2 IN OUT MY_PKG.refcur,
     CUR_OUT3 IN OUT MY_PKG.refcur
    );

I modified the procedure definition to return just one SYS_REFCURSOR:

    PROCEDURE GET_VALUES ( 
      PI_MONTH IN MDETAIL.MONTH%TYPE,
      PI_YR IN MDETAIL.YR%TYPE,
      CUR_OUT IN OUT SYS_REFCURSOR
    );

Below is my modified call that does NOT work to get data with Oracle 12c:

    DataSet ds = DB.ExecuteDataSet("MY_PKG.GET_VALUES", Month,Yr,null);

I am not sure where is the parameter mismatch happening? It would be great if someone can help me out with this.

尝试在“ SYS_REFCURSOR”之后不加逗号

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM