Oracle - Digital processing - taking the rounding, rounding down, to retain the N-bit decimal rounding digital format

. 1  digital operated with oracle sql: Take the rounding, rounding down, retention N decimal, rounding, digitally formatted
 2  
. 3  rounding (rounding down): 
 . 4  SELECT  Floor ( 5.534 ) from Dual;
 . 5  SELECT the trunc ( 5.534 ) from Dual;
 6  above two uses are rounded down number 5.534, the result is 5. the
 . 7  
. 8  to rounded up, the result is obtained 6, should the ceil
 . 9  SELECT ceil ( 5.534 ) from Dual;
 10   
. 11  
12 is  rounded: 
 13 is  the SELECT  round ( 5.534 ) the fROM Dual;
 14 The SELECT  round ( 5.534 , 0 ) the FROM Dual;
 15  the SELECT  round ( 5.534 , . 1 ) the FROM Dual;
 16  the SELECT  round ( 5.534 , 2 ) the FROM Dual;
 . 17 and found to be 6 ,   6 ,   5.5 ,   5.53 
18 is   
. 19  
20 is  retained N decimals (not rounded) in number of bits taken: 
 21 is  SELECT the trunc ( 5.534 , 0 ) from Dual;
22 is  SELECT the trunc ( 5.534 , . 1 ) from Dual;
 23 is  SELECT the trunc ( 5.534 , 2 ) from Dual;
 24 The results were 5 , 5.5 , 5.53 , which is equivalent to the decimal 0 Reserved rounding up directly.
25   
26 is  
27  digitally formatted: 
 28  SELECT TO_CHAR ( 12345.123 , ' 99,999,999.9999 ' ) from Dual;
 29 result 12345. 123 
30  
31 is  SELECT TO_CHAR ( 12345.123, ' 99,999,999.9900 ' ) from Dual;
 32 after the third or fourth decimal up to less than 0, the result is 12345. 1230. 
33 is  
34 is  SELECT TO_CHAR ( 0.123 , ' 99,999,999.9900 ' ) from Dual;
 35  SELECT TO_CHAR ( 0.123 , ' 99,999,990.9900 ' ) from Dual;
 36 result respectively. 123 , 0.123

 

Guess you like

Origin www.cnblogs.com/jeremywucnblog/p/11670105.html