In Firebird, how do I perform rounding before submitting data?

Source: Internet
Author: User
Most of the time, the number after calculation in the stored procedure or trigger needs to be written into the record, but the result number of this operation is often an infinite decimal number, so we need to make a rounding in advance, if the amount is usually two decimal places. At the beginning of Firebird2.1, many built-in functions were added. In this way, many tasks that had to be done through udfs can be directly used.

Most of the time, the number after calculation in the stored procedure or trigger needs to be written into the record, but the result number of this operation is often an infinite decimal number, so we need to make a rounding in advance, if the amount is usually two decimal places. At the beginning of Firebird2.1, many built-in functions were added. In this way, many tasks that had to be done through udfs can be directly used.

Most of the time, the number after calculation in the stored procedure or trigger needs to be written into the record, but the result number of this operation is often an infinite decimal number, Hong Kong server, Hong Kong server rent, therefore, we need to make a rounding in advance for the Hong Kong virtual host. If the amount is usually two decimal places.

At the beginning of Firebird2.1, many built-in functions were added. In this way, many tasks that had to be done through udfs can be directly used.

For example, the Trunc () function can be used to perform rounding data conversion.

Such as this Code:

FAmount = TRUNC (fAmount * fdiscount * fNumber/fTotal), 2)

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.