1

您好我正在尝试创建一个存储过程来更新 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);
                }
            }

        }
4

1 回答 1

0

错误可能出在此参数中:

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

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

于 2012-04-23T11:27:41.460 回答