I'm having problem with the query to compare a column value type varchar2 with a value date string from input. But it always return an error Day of month must be between 1 and last day of month.... Especially when i add Order By clause behind the Where clause. I also check if the column is not equal '0'.
For example: *Table
+----+----------------------+
+ ID + DATE_IN (VARCHAR2) +
+----+----------------------+
+ 1 + 01/04/2020 +
+----+----------------------+
+ 2 + 02/04/2020 +
+----+----------------------+
+ 3 + 04/04/2020 +
+----+----------------------+
+ 4 + 08/04/2020 +
+----+----------------------+
+ 5 + 0 +
+----+----------------------+
INPUT String: '10/04/2020'
My query:
SELECT *
FROM `table_name`
WHERE DATE_IN IS NOT NULL
AND DATE_IN <> '0'
AND TO_DATE(DATE_IN,'DD/MM/YYYY') >= TO_DATE('10/04/2020','DD/MM/YYYY')
ORDER BY ID