ORA-00947: 值不足
Posted
技术标签:
【中文标题】ORA-00947: 值不足【英文标题】:ORA-00947: not enough values 【发布时间】:2013-02-26 20:45:05 【问题描述】:我收到错误“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”,因此我没有将其包含在插入语句中。
【问题讨论】:
【参考方案1】:我看到一个额外的 ")" 。 cast(:LOGTIME_TZ as Timestamp(6) With Time Zone) at time zone '" + oLog.TimeZone + "')
【讨论】:
以上是关于ORA-00947: 值不足的主要内容,如果未能解决你的问题,请参考以下文章
ORA-00947 当 UPDATE 返回 BULK COLLECT INTO 用户创建的 TYPE TABLE 时出现“没有足够的值”