我在插入时遇到日期和时间问题,显示它是无效的月份。我该怎么办?
Insert into PEPSIRENDEEMHISTORY(
PIN,
STATUS,
CURRENTDATE,
MSISDN,
USERNAME,
SIM
)
VALUES(
'4501664170',
1,
'5/12/2013 8:05:26 PM',
'2348121846632',
'ranjith-PC\ranjith',
1
)
答案 0 :(得分:4)
假设currentdate
是时间戳,您需要按以下方式插入它:
TIMESTAMP '2013-05-12 20:05:26'
您的查询将是
INSERT INTO PEPSIRENDEEMHISTORY(PIN,STATUS,CURRENTDATE,MSISDN,USERNAME,SIM)
VALUES ('4501664170', 1, TIMESTAMP '2013-05-12 20:05:26', '2348121846632', 'ranjith-PC\ranjith', 1);
要将其保存为您要插入的格式,您可以使用(根据this)
TO_DATE('5/12/2013 8:05:26 PM','MM/DD/YYYY HH:MI:SS am')