Oracle Database SQL Language Reference 19c states that TO_CHAR (datetime) " converts a datetime or interval value... to a value of VARCHAR2 data type in the format specified by the date format fmt, " and that TO_DATE " converts char to a value of DATE data type, " where " The fmt is a datetime model format specifying the format of char. "
B is correct because it converts the DATE column to a character string in the MON DD YYYY format and compares it with a string in the same format. E is correct because it converts a character literal to a DATE using a format model that matches the literal, so a DATE is compared with a DATE.
A is incorrect because it compares a DATE with a string in MON DD YYYY format; Oracle must convert the string back using DD-MON-RR, and the conversion fails. C is incorrect because TO_DATE is applied to a value that is already a DATE: Oracle first converts it implicitly to text in DD-MON-RR format, which does not match ' MON DD YYYY ' , so an error is raised. D is incorrect because TO_CHAR does not accept a character string with a date format model; the string is treated as a number and the call fails with ORA-01722.
Contribute your Thoughts:
Chosen Answer:
This is a voting comment (?). You can switch to a simple comment. It is better to Upvote an existing comment if you don't have anything to add.
Submit