문제

I have a column(s_time) as varchar. I store 12 hours time(7:00 AM). I want to order by this column(s_time). I tried with this oracle query

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

But this did not work. Can anyone help me doing this?

Thanks in advance.

도움이 되었습니까?

해결책

you seem to be missing the AM / PM part in your format, which can be represented by AM or PM (or in doc also by A.M. or P.M. but I have some problems with the dot version in fiddle at least)

select * from table_time 
order by to_date(s_time, 'HH12:MI AM') asc

다른 팁

to_date('s_time','HH12:MI AM') ASC
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top