本文介绍了ORA-00947:没有足够的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我得到一个错误ORA-00947:没有足够的价值观插入一条记录),并不能明白为什么!在我看来,我有参数的正确号:
I get an error "ORA-00947: not enough values") inserting a record and can't see why! It seems to me I have the correct number of parameters:
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,这是为空的,所以我不包括在INSERT语句。
the table has one more column "LGTIME" which is nullable so I did not include it in insert statement.
推荐答案
我看到一个额外的)。
CAST(:LOGTIME_TZ为时间戳(6)与时区)的< ----- 是在时区'+ oLog.TimeZone +')
I see an extra ")" . cast(:LOGTIME_TZ as Timestamp(6) With Time Zone) <----- at time zone '" + oLog.TimeZone + "')
这篇关于ORA-00947:没有足够的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!