将参数添加到 Oracle 存储过程时出现问题

Issue while adding Parameters to an Oracle Stored procedure

我正在修改一份现有报告。我们也需要维护旧的。所以我创建了一个存储过程,我相信 SP 工作正常。我在 PL/SQL 测试过它。以下是执行现有 SP

的代码
    public static DataSet getReportDataAssetQualityCrisil(string pSPName, int v_UID, string v_FromDt, string v_ToDt, int v_round, string Flag,
                string v_Gilt, string RequestSessionID, string ReportName)
            {
                string strErrMsg = "";
                try
                {
                    DataSet objInvDataSet = null;
                    Database db = DatabaseFactory.CreateDatabase("MutualFund");
                    objInvDataSet = new DataSet();
                    DbCommand dbCmd = db.GetStoredProcCommand(pSPName);
                    dbCmd.CommandType = CommandType.StoredProcedure;
                    db.DiscoverParameters(dbCmd);

                    db.SetParameterValue(dbCmd, "v_UID", v_UID);
                    db.SetParameterValue(dbCmd, "v_FromDt", v_FromDt);
                    db.SetParameterValue(dbCmd, "v_ToDt", v_ToDt);
                    db.SetParameterValue(dbCmd, "v_round", v_round);
                    db.SetParameterValue(dbCmd, "v_Flag", Flag.ToUpper().ToString());

                    db.SetParameterValue(dbCmd, "v_Gilt", v_Gilt);
                    db.SetParameterValue(dbCmd, "V_REQUESTSESSIONID", RequestSessionID);
                    db.SetParameterValue(dbCmd, "v_REPORTTYPE", ReportName);
                    db.SetParameterValue(dbCmd, "resultset_out", null);
                    objInvDataSet = db.ExecuteDataSet(dbCmd);

                    return objInvDataSet;
                }
                catch (Exception ex)
                {
                    strErrMsg = ex.Source;
                    strErrMsg = ex.Message;
                    strErrMsg = ex.StackTrace;
                    return null;
                }
            }
The new report has fewer parameters. Following is the code for the new procedure that I created.
        public static DataSet getReportDataAssetQualityCrisilRevised(string pSPName, string V_FROMDT, string V_TODT, int V_UID, string RequestSessionID)
        {
            string strErrMsg = "";
            try
            {
                DataSet objInvDataSet = null;
                Database db = DatabaseFactory.CreateDatabase("MutualFund");
                objInvDataSet = new DataSet();

                DbCommand dbCmd = db.GetStoredProcCommand(pSPName);
                dbCmd.CommandType = CommandType.StoredProcedure;
                db.DiscoverParameters(dbCmd);
                db.SetParameterValue(dbCmd, "V_FROMDT", V_FROMDT);
                db.SetParameterValue(dbCmd, "V_TODT", V_TODT);
                db.SetParameterValue(dbCmd, "V_UID", V_UID);                
                db.SetParameterValue(dbCmd, "RESULTSET_OUT", null);
                db.SetParameterValue(dbCmd, "V_REQUESTSESSIONID", RequestSessionID);

                objInvDataSet = db.ExecuteDataSet(dbCmd);

                return objInvDataSet;
            }
            catch (Exception ex)
            {
                strErrMsg = ex.Source;
                strErrMsg = ex.Message;
                strErrMsg = ex.StackTrace;
                return null;
            }
        }

但是,当执行控制超过 db.setParameterValue 时,我得到一个异常 "An OracleParameter with ParameterName 'V_FROMDT' is not contained by this OracleParameterCollection."

两个函数在同一个class.

存储过程中的编译错误导致此错误。