SQL TRUNC() Function

SQL TRUNC() function return the truncated number of specified nth number of decimal place.

SQL TRUNC() function supported oracle SQL version

  • Oracle 8i
  • Oracle 9i
  • Oracle 10g
  • Oracle 11g
  • Oracle 12c
  • Oracle 18c

Syntax

TRUNC(n, decimal_number)

n is a number to return a truncated number and
decimal_number is specified nth of decimal place to a truncate.

Example

Consider following example take n number, return the square root of the number.

SQL> SELECT TRUNC(10.1234,1) "TRUNC" FROM DUAL;

     TRUNC
----------
      10.1

SQL> SELECT TRUNC(10.1234,2) "TRUNC" FROM DUAL;

     TRUNC
----------
     10.12

SQL> SELECT TRUNC(10.1234,3) "TRUNC" FROM DUAL;

     TRUNC
----------
    10.123