After Oracle's To_char, why did it become ### #____oracle

Source: Internet
Author: User

T.money is the left column of the following figure

To_char (Round (T.money, 2), ' 0.00 ') is the right column of the following figure




To take it apart, round (t.money,2) means rounding the T.money "two digits after the decimal point".


To_char (XX, ' 0.00 ') is the output of XX according to the format of the 0.00 template.


So 0.00 is what template it is. This depends on the use of the To_char function:

======to_char when converting a number, the template means:

This is the official description:


Writing is really rubbish, let people do not know the so-called.


My understanding, as long as the following can be remembered:

1) 0: If the bit has no value, the default is 0;

2) 9: If the bit has no value, also does not complement 0;


3 How many bits are set in the template value, the final result shows how many bits, that is, the format of the template determines the output format of the result.

As To_char (50.355, ' 99.00 ') results: 50.34


As To_char (500.355, ' 99.00 ') Result: error, because the template is 99.00, that is to 10 bits, and 500.355 exceeds the number of digits of the template.









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.