oracle日期格式

insert into Ecp_Chat_Message(CHATID,CONTENT,IMGURL,SENDUSERID,SENDTIME,RECEIVEUSERID,STATE,ISREAD)
values
(
1,'asdfdf','aaaa','kehu4',to_date('2011-12-03 12:55:45.333333','yyyy-mm-dd hh24:mi:ss.ff'),'serviceid',1,0)

报错如下:

日期格式图片在转换整个输入字符串之前结束

插入到秒的可以这样写,

insert into Ecp_Chat_Message(CHATID,CONTENT,IMGURL,SENDUSERID,SENDTIME,RECEIVEUSERID,STATE,ISREAD)
values
(
1,'asdfdf','aaaa','kehu4',to_date('2011-12-03 12:55:45','yyyy-mm-dd hh24:mi:ss'),'serviceid',1,0)

毫秒级就要用

insert into Ecp_Chat_Message(CHATID,CONTENT,IMGURL,SENDUSERID,SENDTIME,RECEIVEUSERID,STATE,ISREAD)
values
(
1,'asdfdf','aaaa','kehu4',to_timestamp('2011-12-03 12:55:45.333333','yyyy-mm-dd hh24:mi:ss.ff'),'serviceid',1,0)

这种写法,同时注意数据库字段要改成timestamp类型

posted @ 2011-07-05 16:49  艾伦  阅读(669)  评论(0编辑  收藏  举报