I have seen similar posts to this, but I am not able to resolve my query.
I am trying to query a table that has a column ("VALUE") of VARCHAR2 datatype.
The rows in this column are mixed with both numerical and date values (I do not know why the dates were stored as VARCHAR2).
I only need the dates and I have filtered off the rows with LIKE function.
SELECT
PARENTID,
NAME,
VALUE
FROM TIMINGEVENT
WHERE NAME like 'last%'
;
Now the column only has the dates and I need to convert from VARCHAR2 to date.
PARENTID ++ NAME ++ VALUE
1701480 ++ lastCycle1 ++
1701480 ++ lastCycle2 ++
1701480 ++ lastCycle3 ++ 20150901092520 AM
1701480 ++ lastCycle4 ++ 20150901092834 AM
1701480 ++ lastCycle5 ++ 20150901085047 AM
My attempts to use TO_DATE resulted in the following error:
ORA-01858: a non-numeric character was found where a numeric was expected
I am using Oracle 11g SQL Developer and the NLS preferences for date format is set to DD-MON-RR.
I found the below approach in another post, but when I use it it throws the below error?
SELECT
PARENTID,
NAME,
VALUE,
TO_CHAR(TO_DATE(VALUE, 'MM/DD/YYYY'), 'MM/DD/YYYY') AS "test"
FROM TIMINGEVENT
WHERE NAME like 'last%'
;
ORA-01843: not a valid month
01843. 00000 - "not a valid month"