Reputation: 520
I have a table with a column which is of char data type.
And both these queries return same result without throwing any errors:
SELECT * FROM MY_TABLE WHERE CHAR_COL = 0
OR
SELECT * FROM MY_TABLE WHERE CHAR_COL = '0'
Why is this working?
Upvotes: 0
Views: 53
Reputation: 35333
I assume the question is why and not what. The answer is because the database engine in some cases is smart enough to do an implicit casting from one data type to another.
It's not ignoring the datatype, just handling it implicitly:
SOURCES: IBM Casting
Upvotes: 3