NUMBER Data Type

来源:互联网 发布:学生赚钱的软件 编辑:程序博客网 时间:2024/05/17 09:03

Specify a fixed-point number using the following form:

NUMBER(p,s)

where:

  • p is the precision, or the maximum number of significant decimal digits, where the most significant digit is the left-most nonzero digit, and the least significant digit is the right-most known digit. Oracle guarantees the portability of numbers with precision of up to 20 base-100 digits, which is equivalent to 39 or 40 decimal digits depending on the position of the decimal point.

    p相当于有效数字,最左边非零到最右边数字。

  • s is the scale, or the number of digits from the decimal point to the least significant digit. The scale can range from -84 to 127.

    • Positive scale is the number of significant digits to the right of the decimal point to and including the least significant digit.

    • Negative scale is the number of significant digits to the left of the decimal point, to but not including the least significant digit. For negative scale the least significant digit is on the left side of the decimal point, because the actual data is rounded to the specified number of places to the left of the decimal point. For example, a specification of (10,-2) means to round to hundreds.

      s

      正数包括最小有意义数,比如

      .000127

      NUMBER(4,5)

      .00013

      s是5,小数点右边第五位是最小有意义的数,也就是从第五位四舍五入( including the least significant digit

      如果是负数,不包括最小有意义数,比如:

      123.89

      NUMBER(6,-2)

      100

      最小有意义数是百位(从百位四舍五入的),而-2是个位,( not including the least significant digit

      参考:http://docs.oracle.com/cd/E11882_01/server.112/e26088/sql_elements001.htm#SQLRF00222

原创粉丝点击