0

我收到错误“ORA-00947:没有足够的值”)插入记录,但看不出原因!在我看来,我有正确数量的参数:

string sQuery = "insert into EventLog (UserEventLogID, USERID, EVENTSEVERITYID, LOGTIME_TZ, USEREVENTTYPEID, USEREVENTMSG) " +
    "values (0, :USERID, :EVENTSEVERITYID, cast(:LOGTIME_TZ as Timestamp(6) With Time Zone) at time zone '" + oLog.TimeZone + "'), " +
    ":EVENTTYPEID, :EVENTMSG) " +
    " returning USEREVENTLOGID into :EventLogID";

    oraCmd = new OracleCommand();
    oraCmd.BindByName = true;
    oraCmd.Parameters.Add("EVENTSEVERITYID", OracleDbType.Int16, 2, oLog.EventSeverityID, ParameterDirection.Input);
    oraCmd.Parameters.Add("LOGTIME_TZ", OracleDbType.TimeStamp, 6, oLog.EventTimestamp, ParameterDirection.Input);
    oraCmd.Parameters.Add("EVENTTYPEID", OracleDbType.Int16, 4, oLog.EventTypeID, ParameterDirection.Input);
    oraCmd.Parameters.Add("EVENTMSG", OracleDbType.Varchar2, 300, oLog.EventMsg, ParameterDirection.Input);
    oraCmd.Parameters.Add("USERID", OracleDbType.Varchar2, 50, oLog.UserID, ParameterDirection.Input);

    outParam = new OracleParameter("EventLogID", OracleDbType.Decimal);
    outParam.Direction = ParameterDirection.Output;
    oraCmd.Parameters.Add(outParam);

该表还有一列“LGTIME”可以为空,因此我没有将其包含在插入语句中。

4

1 回答 1

1

我看到一个额外的 ")" 。cast(:LOGTIME_TZ as Timestamp(6) With Time Zone) <----- at time zone '" + oLog.TimeZone + "')

于 2013-02-26T20:47:24.373 回答