For example, the number 412 is stored in a format similar to 4.12 x 10^2, with one byte used to store the exponent (2) and two bytes used to store the three significant digits of the mantissa (4, 1, 2). (The resulting value is limited to 38 digits of precision.) Oracle does not store leading and trailing zeros. Each value is stored in scientific notation, with one byte used to store the exponent and up to 20 bytes to store the mantissa. Oracle stores numeric data in variable-length format. To enter numbers that do not use the current default decimal character, use the TO_NUMBER function. You can also change it for the duration of a session with the ALTER SESSION statement. (The decimal is the character that separates the integer and decimal parts of a number.) You can change the default decimal character with the initialization parameter NLS_NUMERIC_CHARACTERS. For example, specifying (7,-2) means Oracle should round to the nearest hundredths, as shown in Table 10-1.įor input and output of numbers, the standard Oracle default decimal character is a period, as in the number "1234.56". If you specify a negative scale, Oracle rounds the actual data to the specified number of places to the left of the decimal point. Table 10-1 How Scale Factors Affect Numeric Data Storage Input Data Table 10-1 shows examples of how data would be stored using different scale factors. When you specify numeric fields, it is a good idea to specify the precision and scale this provides extra integrity checking on input. In this case, the precision is 38 and the specified scale is maintained. You can specify a scale and no precision: Oracle guarantees portability of numbers with a precision equal to or less than 38 digits. If no scale is specified, the scale is zero. If a precision is not specified, the column stores values as given. Optionally, you can also specify a precision (total number of digits) and scale (number of digits to the right of the decimal point):
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |