문제

I have a table in oracle 'punch' where punching data is stored. 'punchtime' column is having the data as varchar2 and time is stored(like 20:30:00). when i want to sort the data by punchtime I use this query

 select * from punch order by to_date(punchtime,'hh24:mi:ss')

This works perfectly. But the below query does not work

select * from punch where punchtime = to_date('01:00:00','hh24:mi:ss')

It shows "not a valid month"

Can anyone please help me. I have to query this column.

도움이 되었습니까?

해결책

As because punchtime is varchar2 datatype column, You need to query :

select * from punch where to_date(punchtime,'hh24:mi:ss') = to_date('01:00:00','hh24:mi:ss')
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top