I have the following condition:
WHERE ORDER_DATE >= TO_DATE (CURRENT_DATE, 'YYYY-MM-DD')
The left part (ORDER_DATE
) is stored as a VARCHAR
and the right part is a DATE
.
When I run the code I have no error; meaning that the comparison between a VARCHAR
and a DATE
is working.
I feel like the VARCHAR
is converted in a DATE
and then the comparison operator is applied; when I have '0000-00-00'
data in the ORDER_DATE
it returns a format error (data exception - invalid value for YYYY format token; Value: '0000-00-00'
).
Can someone confirm that my hypothesis is right?
*Yes I know I should store or convert my VARCHAR
in a DATE
and then perform my comparison between two DATE
and this is what I have done. However, I noticed this particularity and I would like to understand the reason behind!