甲骨文轮负decimal_places?

Oracle round negative decimal_places?

我们知道 explained here oracle ROUND 函数会舍入数字 向上或向下,我可以选择 之后的位数,我想使用,但是 我看到一个函数 ROUND 如下

示例:

select round(125.11,-1) from dual;

负一是什么意思??这里的剂量是多少????

根据the documentation

ROUND returns n rounded to integer places to the right of the decimal point. If you omit integer, then n is rounded to zero places. If integer is negative, then n is rounded off to the left of the decimal point.

所以:

  • round(n, 0) 四舍五入 n 到最近的单位
  • round(n, 1) 四舍五入 n 到最接近的十分之一
  • round(n, -1) 四舍五入 n 到最接近的十位
  • round(n, 2) 四舍五入 n 到最接近的百分之一
  • round(n, -2) 四舍五入 n 到最近的百位

等等