12.07.2015 Views

Oracle SQL Developer

Oracle SQL Developer

Oracle SQL Developer

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Storing Numeric Datadecimal precision, BINARY_FLOAT and BINARY_DOUBLE use binary precision. Thisenables faster arithmetic calculations and usually reduces storage requirements.See Also:■■<strong>Oracle</strong> Database Concepts for information about the internal formatfor the NUMBER data type<strong>Oracle</strong> Database <strong>SQL</strong> Reference for more information about theNUMBER, BINARY_FLOAT, and BINARY_DOUBLE data typesformats5.3.2 Using NUMBER Data TypesThe NUMBER data type stores zero as well as positive and negative fixed numbers withabsolute values from 1.0 x 10 -130 to (but not including) 1.0 x 10 126 . If you specify anarithmetic expression whose value has an absolute value greater than or equal to 1.0 x10 126 , then <strong>Oracle</strong> returns an error. Each NUMBER value requires from 1 to 22 bytes.When you specify a fixed-point number use the following form to specify the precisionand scale of the number:NUMBER(precision, scale)Precision and scale are defined as follows:■ Precision is the total number of significant decimal digits, where the mostsignificant digit is the left-most nonzero digit, and the least significant digit is theright-most known digit. For examples, see Table 5–1 on page 5-4.■ Scale is the number of digits from the decimal point to the least significant digit.The scale can range from -84 to 127. For examples, see Table 5–1 on page 5-4.– Positive scale is the number of significant digits to the right of the decimalpoint to and including the least significant digit.– Negative scale is the number of significant digits to the left of the decimalpoint, to but not including the least significant digit. For negative scale theleast significant digit is on the left side of the decimal point, because the actualdata is rounded to the specified number of places to the left of the decimalpoint. For example, a specification of (10,-2) means to round to hundreds.Scale can be greater than precision, most commonly when e notation is used. Whenscale is greater than precision, the precision specifies the maximum number ofsignificant digits to the right of the decimal point. For example, a column defined asNUMBER(4,5) requires a zero for the first digit after the decimal point and rounds allvalues past the fifth digit after the decimal point.It is good practice to specify the scale and precision of a fixed-point number columnfor extra integrity checking on input. Specifying scale and precision does not force allvalues to a fixed length. If a value exceeds the precision, then <strong>Oracle</strong> returns an error. Ifa value exceeds the scale, then <strong>Oracle</strong> rounds it.Specify an integer using the following form:NUMBER(p)This represents a fixed-point number with precision p and scale 0 and is equivalent toNUMBER(p,0).Specify a floating-point number using the following form:NUMBERData Types: Usage Information 5-3

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!