I am comparing strings with date oracle using the following sql but I am getting incorrect results. I tried with to_date, to_char options but didn't get any proper result.
select order from table where Date1 <> to_char(Date2, 'DD-MON-YYYY HH24:MI');
where Date1 : 10-JUN-21 01.00.00.000000000 AM Date2: 10-JUN-2021 01:00
The above sql returns the rows for above mentioned Date1 and Date2 although it is equal. Also Date1 is varchar format and Date2 is TIMESTAMP(6) WITH LOCAL TIME ZONE format.