I have a table that contains a date error.
The error is a typo that looks like this : 01-AUG-208 instead of 01-AUG-2008. What I am trying to do is create a view from that table with the correct info.
I have tried this but it gives me an ORA-01858: a non-numeric character found where a digit was expected
CREATE OR REPLACE VIEW IC_STRUCTURE("DATE_DE_CONSTRUCTION") AS
SELECT
CASE
WHEN DATE_DE_CONSTRUCTION = '01-AUG-208'
THEN TO_DATE('01-AUG-2008')
ELSE DATE_DE_CONSTRUCTION
END AS DATE_DE_CONSTRUCTION
FROM structure_souterraine;
Unfortunatly i cannot simply update the error by the correct value because that table is updated every month by another database which is the source of the error. I would have to correct it every month.
What is wrong with my query? Is there another work around ?
TO_CHAR( datestamp, 'format')
to get visual dates and useTO_DATE()
to get date types