TRUNC Function in Oracle SQL – PLSQL

The TRUNC function in Oracle SQL / PLSQL is used to get a number truncated to specific number of decimal places.

Syntax for the TRUNC function in Oracle SQL / PLSQL is:

SELECT TRUNC(N,D)
FROM table_name;

  • N is the number to be truncated
  • D is the decimal places up to which N is to be truncated

Example 1:

[sourcecode language=”sql”]
SELECT TRUNC(1.23456,4)
FROM DUAL; [/sourcecode]

Will return “1.2345”


Example 2:

[sourcecode language=”sql”]
SELECT TRUNC(1.23456,3)
FROM DUAL;[/sourcecode]

Will return “1.234”


Example 3:

[sourcecode language=”sql”]
SELECT TRUNC(1.23456,2)
FROM DUAL;[/sourcecode]

Will return “1.23”


Example 4:

[sourcecode language=”sql”]
SELECT TRUNC(-1.23456,3)
FROM DUAL;[/sourcecode]

Will return “-1.234”


Example 5:

[sourcecode language=”sql”]
SELECT TRUNC(1.23456)
FROM DUAL;[/sourcecode]

Will return “1”


Leave a Reply

Your email address will not be published. Required fields are marked *