Saturday, May 5, 2018

Using Round Function with Numbers in PLSQL

https://randomsrsolutions.blogspot.com/2018/05/using-round-function-with-numbers-in.html

The ROUND function Rounds the Column, Expression or Value to n Decimal Places. If the Second argument is 0 or is missing, the value is rounded to Zero decimal places. If the second argument is 2, the value is rounded to two decimal places. Conversely, if the second argument is -2 the value is rounded to two decimal places to the left.
The Round Function can also be used with date functions.

select
Round(5.9283),
Round(5.9283,0),
Round(5.9283,1),
Round(5.9283,2),
Round(5.9283,3)
from dual;

Round(5.9283)    Round(5.9283,0)    Round(5.9283,1)    Round(5.9283,2)    Round(5.9283,3)
                     6                             6                            5.9                        5.93                       5.928


select
Round(3.5397),
Round(3.5397,0),
Round(3.5397,1),
Round(3.5397,2),
Round(3.5397,3)
from dual;

Round(3.5397)    Round(3.5397,0)    Round(3.5397,1)    Round(3.5397,2)    Round(3.5397,3)
                     4                             4                            3.5                        3.54                         3.54

----------------------------------------------------------------------------------------------------

Round with -ve Decimal Request

select
Round(5675.9283,-1),
Round(5675.9283,-2),
Round(5675.9283,-3),
Round(5675.9283,-4)
from dual;

Round(5675.9283,-1)    Round(5675.9283,-2)    Round(5675.9283,-3)    Round(5675.9283,-4)  
                          5680                               5700                               6000                             10000


select
Round(3175.9283,-1),
Round(3175.9283,-2),
Round(3175.9283,-3),
Round(3175.9283,-4)
from dual;

Round(3175.9283,-1)    Round(3175.9283,-2)    Round(3175.9283,-3)    Round(3175.9283,-4)  
                          3180                               3200                               3000                             0

No comments:

Post a Comment

XLA to GL Link

  https://plsqlquery.blogspot.com/2025/12/xla-to-gl-link.html SELECT             acr.cash_receipt_id,             acr.receipt_number,       ...