I need to change column type from VARCHAR2 to DATE. The column is already storing dates in correct format. So I was trying to do something like this
alter INM_INCIDENT rename column INM_I_REACTION_TIME to INM_I_REACTION_TIME_OLD;
alter table INM_INCIDENT add INM_I_REACTION_TIME date;
update INM_INCIDENT set INM_I_REACTION_TIME = to_date(INM_I_REACTION_TIME_OLD);
alter table INM_INCIDENT drop column INM_I_REACTION_TIME_OLD;
But I’ve got error on the line with update statement, so my question is, is there any nice solution for copying varchar to date like this?
Update:
You have to adjust the string
YYYY-MM-DD HH24:MI:SSto your date format in your string date column.