Converting a VARCHAR2 column to a DATE
Posted on 2004-11-17
I'm using Oracle 8, and have a VARCHAR2 column. This column consists of strings in the format 17-NOV-04 14:18. I am doing a search based on the maximum date in this column, therefore I have to change it to a date using TO_DATE(column_name,'MM/DD/YYYY HH:MI') first. The problem I have is that some of the entries in the column are just times (ex. '23:00') or just a single space (' ') and these won't convert to the format I specified in my TO_DATE function, so the query fails. Is there a way to only convert the values that fit the TO_DATE format, or change the ones that don't to some default value, like '01/01/01 12:00'?