SELECT CUSTOMER_NAME, PROTOCOL_REFERENCE, SHIPPING_REFERENCE, CUSTOMER_REFERENCE, COUNTRY, PROJECTED_DELIVERY_DATE, STATUS, NOTES,
WHERE EXPECTED_DESP_DT IS NOT NULL
AND UPPER(PROJECTED_DELIVERY_DATE) NOT LIKE('NULL%')
AND EXPECTED_DESP_DT <= TO_DATE('07/10/2003', 'DD/MM/YYYY')
AND TO_DATE(PROJECTED_DELIVERY_DATE) <= TO_DATE('31/12/2003', 'DD/MM/YYYY') --< Problem here
I need to be able to specify a date filter on the PROJECTED_DELIVERY_DATE field and hence used the TO_DATE(PROJECTED_DELIVERY_DATE) <= TO_DATE('31/12/2003', 'DD/MM/YYYY') but this is generating an ORA-01858: a non-numeric character was found where a numeric character was expected.
I think the problem lies with the fact that this field can contain 'Null' which cannot be converted to a date using TO_DATE. I've tried adding a NOT LIKE ('NULL%') statement to catch any nulls which may be creeping in bu this doesn't solve the problem.
I've added TO_DATE(PROJECTED_DELIVERY_DATE) to the select above to determine if the nulls are being caught and if the TO_DATE in performing the conversion correctly which it is on both counts.
Any ideas anyone ?