Be careful! The precision details are missing when a string is used for SQL statement operations !, SQL missing

Source: Internet
Author: User

Be careful! The precision details are missing when a string is used for SQL statement operations !, SQL missing

I did not update it yesterday. I would like to explain the reason. It was very late when I returned home yesterday. The projects in the company were quite tight over the past few days (there were many bugs, so I was eager to catch up with the demand, my heart trembled.) I didn't prepare materials in time. Today I added another class (I am still in the company, and I have to steal a gap to send a blog, hahaha), so I didn't make any changes last night.

I found a small problem when I changed the bug today. I 'd like to share it with you, but I should be careful.

We have a page where you need to input numbers to the backend, perform related operations, and then query the calculated numbers. The input values on the page are input to the backend of the String type, after calculation, a value with missing precision is obtained, which is converted to the Integer type during query, resulting in an error. The following figure shows the operation result:

Price is of the Decimal type, and 100 is the value passed in by the input on the page. The third column is the conversion result after locating the problem with a colleague, and no error will be reported if the query is performed.

When you need to calculate the page input values in the background later, especially in SQL statements, remember to check the input value type or add "jdbcType =? "To conduct monitoring, in case of errors, to quickly locate and speed up development efficiency (the original development engineer did not write, I and my colleagues located for half an hour to find, I am angry with me, this operation, an error is reported only when the price is a decimal number. The integer value is correct.) Well, today we are here. I'm off duty first, and today the bug is almost changed, happy mood.

My wish is to change the world!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.