TRUNC (Number,num_digits)
Number requires a truncated rounding.
The num_digits is used to specify the number of rounding precision. The default value for Num_digits is 0. If the num_digits is a positive number, the num_digits bit after the decimal point is truncated, and if negative, the integer portion is first preserved, then the forward count starts from the single digit and the number encountered is changed to 0.
The TRUNC () function is intercepted without rounding.
Examples of numbers, such as:
Select Trunc (123.458) from dual--123
Select Trunc (123.458,0) from dual--123
Select Trunc (123.458,1) from dual--123.4
Select Trunc (123.458,-1) from dual--120
Select Trunc (123.458,-4) from dual--0
Select Trunc (123.458,4) from dual--123.458
Select Trunc (123) from dual--123
Select Trunc (123,1) from dual--123
Select Trunc (123,-1) from dual--120
Examples of dates, such as:
Select Trunc (sysdate) from dual--2017/6/13 return date of day
Select Trunc (sysdate, ' yyyy ') from dual--2017/1/1 returns the first day of the year.
Select Trunc (sysdate, ' mm ') from dual--2017/6/1 returns the first day of the month.
Select Trunc (sysdate, ' d ') from dual--2017/6/11 returns the first day of the current week (Sunday is the first day).
Select Trunc (sysdate, ' DD ') from dual--2017/6/13 back to current month day
Select Trunc (sysdate, ' hh ') from dual--2017/6/13 13:00:00 returns the current hour
Select Trunc (sysdate, ' mi ') from dual--2017/6/13 13:06:00 returns the current minute
Oracle's Trunc function