Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一列(s_time)作为varchar。我存储 12 小时的时间(上午 7:00)。我想按此列(s_time)订购。我试过这个 oracle 查询
select * from tabl_time order by to_date('s_time','hh12:mi') asc
但这没有用。任何人都可以帮我这样做吗?
提前致谢。
to_date('s_time','HH12:MI AM') ASC
您似乎缺少格式中的 AM / PM 部分,可以用 AM 或 PM 表示(或者在 doc 中也可以用 AM 或 PM 表示,但我至少在小提琴中的点版本有一些问题)
select * from table_time order by to_date(s_time, 'HH12:MI AM') asc