Summary of Oracle's fractional method for intercepting fixed digits

Source: Internet
Author: User

Trunc,to_char,round,cast

1.trunc intercept the number, the decimal place directly, the whole digit takes 0. Do not make rounding

The second argument is the number of bits to intercept, and if it is not an integer, only the integer digits.

2.to_char (), which turns the number into a character and intercepts the number of digits, and rounds it. For the case of digital operation in this article, the first parameter of To_char can be float,numberic,int,

A second parameter template that describes what form to convert to.

Note D2, because the whole number of ' 9 ' is not enough, selected is ' # # '.

There are more ways to use the To_char function to convert numbers than to refer to the API.

3.round look at the name is the function of the approximate calculation of the number of the trunc, the same usage as the one, but it will be rounded

4.cast to number of specified digits

Summary of Oracle's fractional method for intercepting fixed digits

Related Article

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.