Re: index cannot be used when passing 'int' to 'varchar'
I have some of the answers...
WHERE int_col = '123abc' -- parses the string literal to get 123
WHERE int_col = 'abc' -- parses the string to get 0
To convert a string to an int, you can do 0+'literal' or 0+char_col
WHERE int_col = '1234' -- seems (in newer versions of MySQL) to be equivalent to
WHERE int_col = 1234
The troubling case you had was none of the above --
WHERE char_col = 1234
Subject
Views
Written By
Posted
3036
June 10, 2012 11:16PM
1360
June 11, 2012 11:27PM
1311
June 12, 2012 12:48AM
1373
June 12, 2012 09:23PM
1558
June 12, 2012 11:16PM
Re: index cannot be used when passing 'int' to 'varchar'
1307
June 13, 2012 07:15PM
1305
June 13, 2012 10:35PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.