Oracle questions about number type conversion To_char types

Source: Internet
Author: User

Select To_char (0.1) nums from dual;


It is observed that if the integer digits of the decimal are 0, the converted string does not have the preceding 0, and if the preceding 0 is required, a certain rule is required to format it, as shown below

Select To_char (0.1, ' 0.9 ') nums from dual;


We change the decimal number to an integer and then we look.

Select To_char (1, ' 0.9 ') nums from dual;


Integers can also be programmed with double types

There are many rules about To_char (x, y) and Y, here is an unknown solution, if you want integers or integers, decimals or decimals, you can try the following method, with replace

The reference examples are as follows:

Select Unitname,hurk,ldrk,replace (b, ':. ', ': 0. ') scale,rdate from (select Unitname,hurk,ldrk,concat (' 1: ', round (Hurk/ ldrk,2)) B,rdate from Dynamicpeople)





Oracle questions about number type conversion To_char types

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.