Actually this sort of confusion is more widespread than you might think.
Certainly in Oracle 7 (but it might have changed in later versions) if you had a VARCHAR2 column then it was perfectly legitimate to do:
If column=27 then do something.
as long as the column only ever contained numbers. The minute any row in that column contained a character then the If logic given above would break with a type mismatch because the column and the value were no longer the same type. I know, I know.. they weren’t to start with but it was obviously something to do with how Oracle typed its data structures.