• Skip to primary navigation
  • Skip to main content

Tech Honey

The #1 Website for Oracle PL/SQL, OA Framework and HTML

  • Home
  • HTML
    • Tags in HTML
    • HTML Attributes
  • OA Framework
    • Item in OAF
    • Regions in OAF
    • General OAF Topics
  • Oracle
    • statement
    • function
    • clause
    • plsql
    • sql
You are here: Home / Oracle / function / TRUNC Function in Oracle SQL – PLSQL

TRUNC Function in Oracle SQL – PLSQL

November 5, 2012 by techhoneyadmin

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:

SELECT TRUNC(1.23456,4)
FROM DUAL; 

Will return “1.2345”


Example 2:

SELECT TRUNC(1.23456,3)
FROM DUAL;

Will return “1.234”


Example 3:

SELECT TRUNC(1.23456,2)
FROM DUAL;

Will return “1.23”


Example 4:

SELECT TRUNC(-1.23456,3)
FROM DUAL;

Will return “-1.234”


Example 5:

SELECT TRUNC(1.23456)
FROM DUAL;

Will return “1”


Filed Under: function Tagged With: how to use trunc function in oracle database query, how to use trunc function in oracle plsql, how to use trunc function in oracle sql, syntax and example of trunc function in oracle database query, syntax and example of trunc function in oracle plsql, syntax and example of trunc function in oracle sql, trunc function in oracle plsql, trunc function in oracle sql, TRUNCNUMBERPLSQL, using trunc function in oracle database query, using trunc function in oracle plsql, using trunc function in oracle sql

Copyright © 2023 · Parallax Pro on Genesis Framework · WordPress · Log in