Oracle converts numbers to formatted strings

Source: Internet
Author: User

descriptive narrative of the problem
Oracle assumes the storage number (20,2) data, 0 in the database is 0.00, 2.1 in the database is 2.10, 3.88 is stored as 3.88,
Assume that the corresponding display is taken directly from the database:
0 2.1 3.88 the reserved two decimal places will change, assuming that the database remains consistent:
Workaround
To preserve two-bit valid decimals:

SELECT TO_CHAR(3.2,‘FM99999999999990D00‘FROM DUAL

There's too much nonsense, just a sample:
Examples of references:

SelectTo_char (A,' 99d90 '), To_char (A,' 90d90 '), To_char (A,' fm90d99 '), RTrim (To_char (A,' fm90d99 '), To_char (0,' D ')) from(Select  -A fromDualUnion  All Select 50.57  fromDualUnion  All Select 5.57  fromDualUnion  All Select 0.35  fromDualUnion  All Select 0.4  fromDualOrder  byATo_cha To_cha To_cha RTRIM (------ ------ ------ ------.35 0.35 0.35 0.35.40 0.40 0.4 0.4 5.57 5.57 5.57 5.57 50.00 50.00 50. 50 50.57 50.57) 50.57 50.57

Documentation:

Specific references: click here
Official Document: Oracle Format doc
Sample References: Example

Oracle converts numbers to formatted strings

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.