Skip to Main Content

Convert VARCHAR2 to Date format Oracle 11g

User_OPD8RDec 6 2021

Hello
I want to convert a columns that its format is VARCHAR 2 to Date format
The columns is like this:
csv_stats_gen_time - column name
type: Varchar2
Example value: 2021-05-05 17:15:15:489

So i am using this query to convert it:

SELECT TO_CHAR(TO_DATE(csv_stats_gen_time,'YYYY-MM-DD hh:mi:ss:mis'), 'YYYY-MM-DD')
FROM table_name
But it promts the error: ORA-01810: format code appears twice

Please can you support me on converting this column to 'YYYY-MM-DD' format?

Thanks
Dario

Comments
Post Details
Added on Dec 6 2021
5 comments
3,309 views