convert, as the name suggests, means conversion, cast is almost the same
MySQL CONVERT() function | Reference Manual
Why is this function needed? MySQL is weakly typed and will automatically convert where stringcol=1 and intcol='1', so why should I do it?
MySQL has a type called double. Basically no one uses it, but some people do. . . There will be problems if you use it.
例如sql select NUMBER_ATTRIBUTE_4 from dwaps.aps_cm_config_data_ce
Find data from database
Query through java code
Did you see that scientific notation has appeared? How is this possible? How to solve it?
It's very simple. Java uses scientific notation when reading double. Then I don't read double and just read varchar.
select convert(NUMBER_ATTRIBUTE_4,char) from dwaps.aps_cm_config_data_ce
Has the problem been solved? It seemed to be solved, but it was not. A few days later, another problem was discovered.
targetId=506 batchid=906134083510206460
java read
But the result targetId=506.0 batchid=9.061340835102065e17
Converted to char targetId=506 batchid=9.061340835102065e17 is still wrong
Only convert(BATCH_ID,SIGNED)
It can only be converted to int, so use double type with caution.