Oracle number type Rule Description

Source: Internet
Author: User

The NUMBER type Rule Description of ORACLE in Oracle the Number type can be used to store 0, positive and negative fixed point or floating point NUMBER, the data range can be expressed in 1.0*10 (-130) -- 9. 9... 9*10 (125) {38 9 followed by 88 0} digits. When the value of the mathematical expression in Oracle is greater than or equal to 1.0*10 (126, oracle Reports an error. The data declaration of Number is as follows: it indicates that Number (p, s) declares that precision is set to p (precision), and s (scale) indicates the Number of digits on the right of the decimal point, the maximum precision is 38. The value range of scale is-84 to 127 Number (p). Declare an integer equivalent to Number (p, 0) Number. Declare a floating point. The precision is 38, note that the scale value is not applied. That is to say, scale cannot be simply understood as 0 or another number. The precision (p) and Scale (s) of the number of points follow the rules below: when the length of the integer part of A number is greater than p-s, oracle will report an error when the length of a decimal part is greater than s, Oracle will round. When s (scale) is a negative number, Oracle rounds the s number on the left of the decimal point. When s> p, p indicates the maximum number of digits (s) to the left after the decimal point. If p is greater than p, Oracle Reports an error. The number (s) to the right after the decimal point is rounded. NUMBER Type Details Oracle number datatype Syntax: NUMBER [(precision [, scale])] Abbreviation: precision --> p scale --> s NUMBER (p, s) range: 1 <= p <= 38,-84 <= s <= 127 stored data range:-1.0e-130 <= number value <1.0e + 126 stored in the machine range: 1 ~ 22 bytes valid bits: the number of digits from the first digit on the left that is not 0. S: s> 0 is accurate to the second place on the right of the decimal point, and rounded. Then, check whether the valid bit is <= p. S <0 is accurate to the second place on the left of the decimal point, and is rounded to five. Then, check whether the valid bit is <= p + | s |. S = 0 at this time, NUMBER indicates an integer. Eg: Actual Data Specified As Stored As random 123.89 NUMBER 123.89123.89 NUMBER (3) 124123.89 NUMBER (6, 2) 123.89123.89 NUMBER (6, 1) 123.9123.89 NUMBER (4, 2) exceeds precision (valid bit: 5, 5> 4) 123.89 NUMBER (6,-2) 100.01234 NUMBER (4, 5 ). 01234 (effective bit: 4 ). 00012 NUMBER (4, 5 ). 00012.000127 NUMBER (4, 5 ). 00013.0000012 NUMBER (2, 7 ). 0000012.00000123 NUMBER (2, 7 ). 00000121.2e-4 NUMBER () 0.000121.2e-5 NUMBER () 0.20.00003.2564 NUMBER 123.25641234.9876 NUMBER () Limit NUMBER () Error (valid bit: 5 + 2> 6) 1234.9876 NUMBER (6) 1235 (s does not indicate s = 0) 12345.345 NUMBER (5,-2) 123001234567 NUMBER (5,-2) 123460012345678 NUMBER (5,-2) error (valid bits 8> 7) 123456789 NUMBER (5,-4) 1234600001234567890 NUMBER (5,-4) Error (valid bits 10> 9) 12345.58 NUMBER (*, 1) 12345.60.1 NUMBER (0.10000) Error (0.01234567, valid bit: 5> 4) 0.09999 NUMBER () 0.01235000009999 NUMBER ()

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.