How decimals with an absolute value less than 1 in Oracle displays the 0 in front of the decimal point

Source: Internet
Author: User
Tags rtrim

In Oracle, if the absolute value is less than 1 decimal, only the value after the decimal point is displayed, and 0 in front of the decimal point is ignored, for example: 0.1 is displayed as. 1 in Oracle.

How to resolve this type of problem:

x=0.2

To_char (' fm9999990.9999 ', x) output value is 0.2

But now there is a problem, if it is x=10, then the display will be 10. , in the back will be a small number of points, so it is not good to see, how to display the actual input, on the Internet to find another Oracle character processing function RTrim, so now these changes can be as follows:
X =10
RTRIM (To_char (' fm9999990.9999′,x), '. ') →10
After this has been processed, if the integer is displayed correctly as an integer, the decimal number is displayed with the 4-bit precision reserved.

Scenario Two:
In addition, the following methods can be processed:
Select

DECODE (TRUNC (:d ecimal_number),
REPLACE (to_char (:d ecimal_number), '. ','to_char(:d ecimal_number)
)
from dual;

How decimals with an absolute value less than 1 in Oracle displays the 0 in front of the decimal point

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.