!!!在oracle中,用update语句时,日期时间如何处理!!!!

a13489905321 2011-12-30 04:27:10
update Sf_Msg_Monthly set smm_Closed_Time=to_date('2011-12-30','yyyy-MM-dd') where smm_Monthlyid = 1
这样可以!!

为什么这样就不行了
update Sf_Msg_Monthly set smm_Closed_Time=to_date('2011-12-30 11:54:30','yyyy-MM-dd hh24 :mm:ss') where smm_Monthlyid = 1


求解 求等待!!!

...全文
22275 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
玄海武马 2011-12-31
  • 打赏
  • 举报
回复
也可以 update Sf_Msg_Monthly set smm_Closed_Time=to_char('2011-12-30 11:54:30','yyyy-MM-dd hh24:mi:ss') where smm_Monthlyid = 1
xiaoyu871225 2011-12-31
  • 打赏
  • 举报
回复
时间格式错了!
注意下年月日格式yyyy-MM-dd:hh24:mi:ss

我心飞翔 2011-12-31
  • 打赏
  • 举报
回复
SQL语句的问题,请按下面的代码来修改(看仔细点)

UPDATE Sf_Msg_Monthly
SET smm_Closed_Time = to_date('2011-12-30 11:54:30','yyyy-MM-dd HH24:MI:SS')
WHERE smm_Monthlyid = 1;
huangdh12 2011-12-30
  • 打赏
  • 举报
回复
yyyy-MM-dd hh24 :mm:ss oracle并不区分大小写,
但是 分钟是mi ,你的mm 表示 有 月份有50多的,那肯定会报错。
jasher 2011-12-30
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 tx2730 的回复:]

lz没看仔细,hh24后面多了一个空格,去掉空格就好了
SQL code
update Sf_Msg_Monthly set smm_Closed_Time=to_date('2011-12-30 11:54:30','yyyy-MM-dd hh24:mm:ss') where smm_Monthlyid = 1
[/Quote]

和空格没有关系,格式问题 hh24:mi:ss
007-x 2011-12-30
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 hj_daxian 的回复:]
引用 3 楼 tx2730 的回复:

lz没看仔细,hh24后面多了一个空格,去掉空格就好了
SQL code
update Sf_Msg_Monthly set smm_Closed_Time=to_date('2011-12-30 11:54:30','yyyy-MM-dd hh24:mm:ss') where smm_Monthlyid = 1


关于'-'和':'旁边……
[/Quote]
大意了,没看到hh24:后面是用mm
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 tx2730 的回复:]

lz没看仔细,hh24后面多了一个空格,去掉空格就好了
SQL code
update Sf_Msg_Monthly set smm_Closed_Time=to_date('2011-12-30 11:54:30','yyyy-MM-dd hh24:mm:ss') where smm_Monthlyid = 1
[/Quote]

关于'-'和':'旁边有没空格都可以正确执行
007-x 2011-12-30
  • 打赏
  • 举报
回复
lz没看仔细,hh24后面多了一个空格,去掉空格就好了
update Sf_Msg_Monthly set smm_Closed_Time=to_date('2011-12-30 11:54:30','yyyy-MM-dd hh24:mm:ss') where smm_Monthlyid = 1
loveofmylife 2011-12-30
  • 打赏
  • 举报
回复
yyyy-MM-dd hh24 :mi:ss
  • 打赏
  • 举报
回复
注意下年月日格式yyyy-MM-dd:hh24:mi:ss

update Sf_Msg_Monthly set smm_Closed_Time=to_date('2011-12-30 11:54:30','yyyy-MM-dd:hh24:mi:ss') where smm_Monthlyid = 1

17,377

社区成员

发帖
与我相关
我的任务
社区描述
Oracle 基础和管理
社区管理员
  • 基础和管理社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧