调用的参数的数量或类型错误

时间:2012-04-23 11:05:05

标签: c# sql oracle stored-procedures oracle-sqldeveloper

您好我正在尝试创建一个存储过程来更新Oracle SQL开发人员中的列。从c#调用函数时出现此错误:

ORA-06550:第5行第3栏: PLS-00306:调用'SP_UPDATEREFILLCHECKPLANSET'时参数的数量或类型错误 ORA-06550:第5行,第3栏: PL / SQL:忽略语句

原因是什么?如何解决这个问题?

以下程序:

create or replace
PROCEDURE SP_UPDATEREFILLCHECKPLANSET 
(
  In_MasterAdjustMaxRefillChecks IN "Ref_RefillCheckPlanSettings"."MasterAdjustMaxRefillChecks"%type,
  In_DefDaysBetweenRefillChecks IN "Ref_RefillCheckPlanSettings"."DefaultDaysBetweenRefillChecks"%type,
  In_MasterAdjustMaxNotices IN "Ref_RefillCheckPlanSettings"."MasterAdjustMaxNotices"%type,
  In_DefaultDaysBetweenNotices IN "Ref_RefillCheckPlanSettings"."DefaultDaysBetweenNotices"%type,
  In_DaysBefore1stRefillCheckNot IN "Ref_RefillCheckPlanSettings"."DaysBefore1stRefillCheckNotice"%type,
  In_SendNoticeIfPositiveBalance IN "Ref_RefillCheckPlanSettings"."SendNoticeIfPositiveBalance"%type,
  In_DefaultDaysAfterTermination IN "Ref_RefillCheckPlanSettings"."DefaultDaysAfterTermination"%type,
  In_EmergencyShutDown IN "Ref_RefillCheckPlanSettings"."EmergencyShutDown"%type,
  In_Reason IN "Ref_RefillCheckPlanSettings"."Reason"%type,
  In_MasterAmountOfPauses IN "Ref_RefillCheckPlanSettings"."MasterAmountOfPauses"%type,
  In_MaxAmountOfPauseDays IN "Ref_RefillCheckPlanSettings"."MaxAmountOfPauseDays"%type,
  In_Id IN NUMBER
)
AS 
BEGIN
UPDATE "Ref_RefillCheckPlanSettings"
  SET
    "MasterAdjustMaxRefillChecks" = In_MasterAdjustMaxRefillChecks,
    "DefaultDaysBetweenRefillChecks" = In_DefDaysBetweenRefillChecks,
    "MasterAdjustMaxNotices" = In_MasterAdjustMaxNotices,
    "DefaultDaysBetweenNotices" = In_DefaultDaysBetweenNotices,
    "DaysBefore1stRefillCheckNotice" = In_DaysBefore1stRefillCheckNot,
    "SendNoticeIfPositiveBalance" = In_SendNoticeIfPositiveBalance,
    "DefaultDaysAfterTermination" = In_DefaultDaysAfterTermination,
    "EmergencyShutDown" = In_EmergencyShutDown,
    "Reason" = In_Reason,
    "MasterAmountOfPauses" = In_MasterAmountOfPauses,
    "MaxAmountOfPauseDays" = In_MaxAmountOfPauseDays
    WHERE "Id" = In_Id;
END SP_UPDATEREFILLCHECKPLANSET;

对更新存储过程的调用。

public void UpdateRefillCheckPlanSettings(RefillCheckPlanSettings updatedSettings)
        {
            if (_dbConn.State != ConnectionState.Open)
            {
                _dbConn.Open();
            }

            const string command = "SP_UPDATEREFILLCHECKPLANSET";

            using (var oracleCommand = new OracleCommand(command, _dbConn))
            {
                oracleCommand.CommandType = CommandType.StoredProcedure;

                try
                {
                    oracleCommand.Parameters.AddWithValue("In_MasterAdjustMaxRefillChecks", updatedSettings.MasterAdjustMaxRefillChecks);
                    oracleCommand.Parameters.AddWithValue("In_DefDaysBetweenRefillChecks", updatedSettings.DefaultDaysBetweenRefillChecks);
                    oracleCommand.Parameters.AddWithValue("In_MasterAdjustMaxNotices", updatedSettings.MasterAdjustMaxNotices);
                    oracleCommand.Parameters.AddWithValue("In_DefaultDaysBetweenNotices", updatedSettings.DefaultDaysBetweenNotices);
                    oracleCommand.Parameters.AddWithValue("In_DaysBefore1stRefillCheckNot", updatedSettings.DaysBeforeFirstRefillCheckNotice);
                    oracleCommand.Parameters.AddWithValue("In_SendNoticeIfPositiveBalance", updatedSettings.SendNoticeIfPositiveBalance);
                    oracleCommand.Parameters.AddWithValue("In_DefaultDaysAfterTermination", updatedSettings.DefaultDaysAfterTermination);
                    oracleCommand.Parameters.AddWithValue("In_EmergencyShutDown", updatedSettings.EmergencyShutDown);
                    oracleCommand.Parameters.AddWithValue("In_Reason", updatedSettings.Reason);
                    oracleCommand.Parameters.AddWithValue("In_MasterAmountOfPauses", updatedSettings.MasterAmountOfPauses);
                    oracleCommand.Parameters.AddWithValue("In_MaxAmountOfPauseDays", updatedSettings.MaxAmountOfPauseDays);
                    oracleCommand.Parameters.AddWithValue("In_Id", updatedSettings.Id);
                    oracleCommand.ExecuteNonQuery();
                }
                catch (Exception ex)
                {
                    Log.Fatal("Couldn't update RefillCheckPlanSettings! RefillCheckPlanSettings: '" + updatedSettings.Id + "'", ex);
                }
            }

        }

1 个答案:

答案 0 :(得分:0)

错误可能在此参数中:

In_DaysBefore1stRefillCheckNot IN "Ref_RefillCheckPlanSettings"."DaysBefore1stRefillCheckNotice"%type,  
oracleCommand.Parameters.AddWithValue("In_DaysBefore1stRefillCheckNot", updatedSettings.DaysBeforeFirstRefillCheckNotice);

因为类型名称不相等:
DaysBefore * 1st * RefillCheckNotice!= DaysBefore * First * RefillCheckNotice