NUMBER Data Type

The NUMBER data type stores zero as well as positive(肯定的,确定的,正数) and negative(负数,负的) fixed numbers with absolute values(绝对值)  from 1.0 x 10-130 to but not including 1.0 x 10126. If you specify an arithmetic(算术) expression_r(表达,表达式) whose value has an absolute value greater(大于) than or equal to 1.0 x 10126, then Oracle returns an error. Each NUMBER value requires(需要) from 1 to 22 bytes.

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(小数点).

  • 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.

Scale can be(能够,可以) greater(大于) than precision, most commonly(最常用的) when e notation(注释,标记) is used. When scale is greater than precision, the precision specifies the maximum number of significant digits to the right of the decimal point. For example, a columndefined(定义) as NUMBER(4,5) requires a zero for the first digit after the decimal point and rounds all values past(过去,往事) the fifth digit after the decimal point.

It is good practice(好做法) to specify the scale and precision of a fixed-point number column forextra(额外) integrity(完整) checking on(检查,核实) input. Specifying scale and precision does not force all values to a fixed length. If a value exceeds(超过) the precision, then Oracle returns an error. If a value exceeds the scale, then Oracle 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 to(相当于) NUMBER(p,0).

Specify a floating-point number(浮点数) using the following form:

NUMBER

The absence(没有) of precision and scale designators(指定这,标志符) specifies the maximum range and precision for an Oracle number.

See Also(另见):

"Floating-Point Numbers"

Table 3-2 show how Oracle stores data using different precisions and scales.

### 如何在 Element UI 中将 `el-input` 组件的类型设置为数字 为了使 `el-input` 组件能够处理数值输入并提供相应的浏览器验证功能,可以将其 `type` 属性设置为 `"number"`。这不仅改变了输入框的行为,还启用了HTML5内置的数字键盘支持以及基本的数值范围约束。 下面是一个简单的例子来展示如何配置: ```html <template> <div class="demo"> <!-- 使用 type='number' 来指定 el-input 应该作为数字输入 --> <el-input v-model.number="numValue" placeholder="请输入数字..." type="number" min="0" max="100" step="1"> </el-input> {{ numValue }} </div> </template> <script> export default { name: 'NumberInputExample', data() { return { // 初始化数据模型,默认值设为空字符串或null表示无初始值 numValue: '' }; } }; </script> ``` 在这个实例中,通过向 `<el-input>` 添加 `type="number"` 参数指定了这是一个用于接收数字类型的输入控件[^3]。此外,还可以利用其他属性如 `min`, `max`, 和 `step` 对允许输入的具体数值加以限制。值得注意的是,在这里也应用了 `.number` 修改符到 `v-model` 上,这样即使用户手动删除内容使得输入框为空时,绑定的数据也会被正确解析成 JavaScript 的 `NaN` 或者保持之前的合法状态而不是变成空串[^1]。 对于某些特定场景下的需求调整,比如希望未达到设定最小值时不显示任何内容,则可以通过监听事件或者计算属性等方式进一步自定义行为逻辑。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值