1) ROUND
This command is used to round the decimal values. If the decimal value is greater than or equal to .5 then it is rounded to next value else rounded to the current value.
Example
SELECT ROUND(157.7), ROUND(157.5), ROUND(157.3) FROM DUAL;
Output
ROUND(157.7) ROUND(157.5) ROUND(157.3)
------------ ------------ ------------
158 158 157
2) TRUNC
This command is used to round the decimal point to the current value.
Example
SELECT TRUNC(157.7), TRUNC(157.5), TRUNC(157.4) FROM DUAL;
Output
TRUNC(157.7) TRUNC(157.5) TRUNC(157.4)
------------ ------------ ------------
157 157 157
3) MOD
This command is used to show the remainder.
Example
SELECT MOD(5,2),MOD(2,2) FROM DUAL;
Output
MOD(5,2) MOD(2,2)
---------- ---------
1 0
This command is used to round the decimal values. If the decimal value is greater than or equal to .5 then it is rounded to next value else rounded to the current value.
Example
SELECT ROUND(157.7), ROUND(157.5), ROUND(157.3) FROM DUAL;
Output
ROUND(157.7) ROUND(157.5) ROUND(157.3)
------------ ------------ ------------
158 158 157
2) TRUNC
This command is used to round the decimal point to the current value.
Example
SELECT TRUNC(157.7), TRUNC(157.5), TRUNC(157.4) FROM DUAL;
Output
TRUNC(157.7) TRUNC(157.5) TRUNC(157.4)
------------ ------------ ------------
157 157 157
3) MOD
This command is used to show the remainder.
Example
SELECT MOD(5,2),MOD(2,2) FROM DUAL;
Output
MOD(5,2) MOD(2,2)
---------- ---------
1 0
No comments:
Post a Comment