I have a functional select statement that has a where clause, in the where clause there is a statement like so...
to_date(camp.start_date, 'MM/DD/YYYY') >= to_date(:from_date, 'YYYY-MM-DD HH24:MI:SS')
However, if camp.start_date is NULL or has no rows then it is throwing an exception -
ORA-01858: a non-numeric character was found where a numeric was expected
camp.start_date is actually a VARCHAR2 that I need to convert into a date, (yes I know it probably should be a date field but I don't have the options to change this).
I tried something like this...
to_date(NVL(camp.start_date,SYSDATE), 'MM/DD/YYYY') >=
to_date(:from_date, 'YYYY-MM-DD HH24:MI:SS')
Which still is giving me an error. Also tried
where camp.start_date is not null and to_date(camp.start_date, 'MM/DD/YYYY') >= to_date(:from_date, 'YYYY-MM-DD HH24:MI:SS')
same issue. What is the best way around this? Basically to_date is exploding and throwing an error when camp.start_date is not a valid date.