請我需要在Oracle INSERT語句一些幫助,我用Oracle SQL Developer tool
,這是插入語句錯誤的日期時間與甲骨文插入語句
INSERT INTO ITEMAPPROVAL (REQUESTITEMID, USERID, APPROVALSTATUS, REQUESTSTATUSID, ITEMAPPROVALDATE, ITEMAPPROVALNOTE , APPROVEDAMOUNT)
VALUES ('132568', '15', '1', '4', TO_DATE('06/02/1436:10:6i:41a6', 'mm/dd/yyyy:hh:mi:ssam'), '' ,'20000');
上運行總是我有以下錯誤
Error starting at line : 23 in command -
INSERT INTO ITEMAPPROVAL (REQUESTITEMID, USERID, APPROVALSTATUS, REQUESTSTATUSID, ITEMAPPROVALDATE, ITEMAPPROVALNOTE , APPROVEDAMOUNT)
VALUES ('132568', '15', '1', '4', TO_DATE('06/02/1436:10:6i:41am', 'mm/dd/yyyy:hh:mi:ssam'), '' ,'20000')
Error report -
SQL Error: ORA-01861: literal does not match format string
01861. 00000 - "literal does not match format string"
*Cause: Literals in the input must be the same length as literals in
the format string (with the exception of leading whitespace). If the
"FX" modifier has been toggled on, the literal must match exactly,
with no extra whitespace.
*Action: Correct the format string to match the literal.
我認爲錯誤屬於日期格式,我多搜索了一下,但沒有任何希望
更新:
格式從Visual Studio生成像
query = "INSERT INTO ITEMAPPROVAL " +
" (REQUESTITEMID, USERID, APPROVALSTATUS, REQUESTSTATUSID, ITEMAPPROVALDATE, ITEMAPPROVALNOTE , APPROVEDAMOUNT) " +
" VALUES ('" + itemapproval.RequestItemID + "', '" + itemapproval.User.ID + "', '" + itemapproval.status + "', '" + itemapproval.requeststatus.ID + "', TO_DATE('" + itemapproval.date.ToString("mm/dd/yyyy:hh:mi:ssam") + "', 'mm/dd/yyyy:hh:mi:ssam'), '" + itemapproval.notes + "' ,'" + itemapproval.ApprovedAmount + "'); "
ERM TO_DATE('06/02/1436:10:6I:41a6' – 2014-11-24 07:38:42
您的日期輸入??什麼是6I – 2014-11-24 07:38:49
感謝米奇和Maheswaran快速回復,我得到了這個日期從點網轉換就像我寫的嗎?在問題更新 – 2014-11-24 07:43:15