Am trying to get the lowest date and highest date from a table column. Am using below SQL query for that.
select MIN(trunc(TO_DATE(MOD_BEGIN, 'YYYYMMDDHH24MISS'))) AS MIN_DATUM
, MAX(trunc(TO_DATE(MOD_END, 'YYYYMMDDHH24MISS'))) AS MAX_DATUM
from V_IPSL_PPE_MUC_AZEIT;
FYI - Am using this query in PL/SQL. From the above query's output I will be generating date range. We are using oracle 19c.
But problem is these columns MOD_BEGIN, MOD_END have very few invalid values (e.g: 00000001000000) due to this when I execute the above query I get error message saying:
ORA-01843: not a valid month
ORA-02063: preceding line from L_IPSL_PPE_MUC
We are not allowed to cleanup this invalid data.
How to handle this scenario?