to_char and to_date are returning different output
问题 I am using below queries. select sysdate from dual where to_char(sysdate,'DD-MM-YY')='28-MAY-13'; and the output is null. But for below query, output is current date. select sysdate from dual where to_date(sysdate,'DD-MM-YY')= to_date('28-MAY-13','DD-MM-YY'); Why the to_char function can not return the sysdate? Shouln't we use to_char to compare date? 回答1: Try 'DD-MON-YY' format to map to '28-MAY-13' 'MM' maps to the month number. EDIT: SQL can figure out to use the correct format in to_date;