Oracle problems with number type conversion to_char

Source: Internet
Author: User

Oracle problems with number type conversion to_char

Oracle problems with number type conversion to_char

Select to_char (0.1) nums from dual;

It is observed that if the integer of a decimal number is 0 and the preceding 0 is not displayed after the string is converted, and if the preceding 0 is required, some rules are required for formatting. The example is as follows:

Select to_char (0.1, '0. 9') nums from dual;

Let's Replace the decimal number with an integer and then look at it again.

Select to_char (1, '0. 9') nums from dual;

Integers are also programmed to be of the double type.

There are many rules for to_char (x, y) and y. I will not explain them here. If you want an integer, an integer, or a decimal number, try the following method.

Example:

Select unitname, hurk, ldrk, replace (B ,':. ',': 0. ') scale, rdate from (select unitname, hurk, ldrk, concat ('1:', round (hurk/ldrk, 2) B, rdate from DYNAMICPEOPLE)

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.