Mega Code Archive

 
Categories / Oracle PLSQL Tutorial / Numerical Math Functions
 

TRUNC(x, [y]) gets the result of truncating the number x to an optional y decimal places

If y is omitted, x is truncated to zero decimal places. If y is negative, x is truncated to the left of the decimal point. The following example displays truncating 5.75 to zero, 1, and - 1 decimal places: SQL> SELECT TRUNC(5.75), TRUNC(5.75, 1), TRUNC(5.75, -1) FROM dual; TRUNC(5.75) TRUNC(5.75,1) TRUNC(5.75,-1) ----------- ------------- --------------           5           5.7              0 SQL>