# TRUNC (numbers) function in Oracle

TRUNC (numbers) is one of the vital Numeric/Math functions of Oracle. It is used to get a number truncated to a certain number of decimal places. The TRUNC (numbers) function is supported in the various versions of the Oracle/PLSQL, including, Oracle 12c, Oracle 11g, Oracle 10g, Oracle 9i and Oracle 8i.

Syntax:

TRUNC (number, decimal_places)


Parameters:
number: It is used to specify the numbers to be truncated.
decimal_places: It is an optional parameter which is used to specify the number of decimal places to be truncated to.

Example 1:

TRUNC (10.789)

Output:

10


Explanation:
By default the TRUNC (numbers) function returns the nearest integer value if the decimal_places parameter is not specified.

Example 2:

TRUNC (10.789, 1)

Output:

10.7


Explanation:
The TRUNC (numbers) function returns the value truncated to the mentioned decimal_places.

Example 3:

TRUNC (225.789, -1)


Output:

220


Explanation:
The TRUNC (numbers) function returns the value truncated to the mentioned decimal_places.