0

我有一列(s_time)作为varchar。我存储 12 小时的时间(上午 7:00)。我想按此列(s_time)订购。我试过这个 oracle 查询

select * from tabl_time order by to_date('s_time','hh12:mi') asc

但这没有用。任何人都可以帮我这样做吗?

提前致谢。

4

2 回答 2

1
to_date('s_time','HH12:MI AM') ASC
于 2014-02-17T13:36:17.967 回答
1

您似乎缺少格式中的 AM / PM 部分,可以用 AM 或 PM 表示(或者在 doc 中也可以用 AM 或 PM 表示,但我至少在小提琴中的点版本有一些问题)

select * from table_time 
order by to_date(s_time, 'HH12:MI AM') asc
于 2014-02-17T13:34:43.180 回答