Oracle ceil for decimal numbers

When rounding to 2 decimal places, the value 4.01132141 will be rounded to 4.02, since it exceeds 4.01.

How can you do this in PL / SQL?

+3
source share
5 answers

The "round up" function is CEIL , but it generates an integer.

The function "round down" is FLOOR , but it also generates an integer.

The round function is near ROUND , and it allows you to specify the number of decimal places (dp).

, CEIL ; 2 , 100, CEIL 100.


, :

ROUND(value+0.005, 2)

, 4.01132141 , ROUND, 4.01632, 2 4.02. 4.0593, , , ROUND, 4,0643, 2 4,06, .

:

  • dp , , (0,005 ), . . 10 ..
  • . -4.01132141 -4.02 -4.01? , SIGN ABS, , .
+4

- ceil(value*100)/100, . , round , .

+3

: .

select 4.01132141+(mod((ceil(4.01132141)-4.01132141)*1000,10)/1000) from dual
+1

4.01132141, CEIL (4.01132141 * 100)/100

0

PLSQL: ROUND (UrNo + (5/POWER (10, DecimalPlaces + 1)), DecimalPlaces)

0

Source: https://habr.com/ru/post/1764112/


All Articles