数字 function

SELECT 
TRUNC(15.79),
TRUNC(15.79,1),
ROUND(15.79),
ROUND(15.79,1),
ROUND(115.79,-2),
FLOOR(26.983),
CEIL(26.123),
SIGN(-25),
SIGN(0),
SIGN(25),
MOD(10,4)
FROM dual;
TRUNC(15.79) TRUNC(15.79,1) ROUND(15.79) ROUND(15.79,1) ROUND(115.79,-2) FLOOR(26.983) CEIL(26.123)  SIGN(-25)    SIGN(0)   SIGN(25)  MOD(10,4)
------------ -------------- ------------ -------------- ---------------- ------------- ------------ ---------- ---------- ---------- ----------
          15           15.7           16           15.8              100            26           27         -1          0          1          2 

TRUNC:
Returns the number or expression passed as parameter
Syntax:
TRUNC(original_number[,n])
The parameter for the number of decimals (n
original number to convert it into an integer.
If n is negative, the function truncates n digits to the left of the decimal point.
ROUND:
Returns the number or expression passed as parameter
Syntax:
ROUND(original_number[,n])
The parameter for the number of decimals (n
original number to convert it into an integer.
If n is negative, the function rounds off n digits to the left of the decimal point.
FLOOR:
Returns the largest integer that is equal to or less than
decimals from the original number, if it is not an integer.
integer.
Syntax:
FLOOR(original_number)
CEIL:
Returns the smallest integer that is greater than or equal to
number passed has decimals it returns the next integer.
Syntax:
CEIL(original_number)
SIGN:
Returns a number that represents the sign of the number passed as parameter
number passed is positive it returns 1, and it returns 0 if the number passed is 0.
Syntax:
SIGN(number)
MOD:
Returns the remainder of the first_number divided by
Syntax:
MOD(first_number,second_number)

原文地址:https://www.cnblogs.com/kakaisgood/p/9566207.html