TRUNC Demo : TRUNC « Numeric Math Functions « Oracle PL / SQL






TRUNC Demo

 
 
SQL> SELECT TRUNC(1234.5678, 4) FROM DUAL;

TRUNC(1234.5678,4)
------------------
         1234.5678

SQL> SELECT TRUNC(1234.5678, 3) FROM DUAL;

TRUNC(1234.5678,3)
------------------
          1234.567

SQL> SELECT TRUNC(1234.5678, 2) FROM DUAL;

TRUNC(1234.5678,2)
------------------
           1234.56

SQL> SELECT TRUNC(1234.5678, 1) FROM DUAL;

TRUNC(1234.5678,1)
------------------
            1234.5

SQL> SELECT TRUNC(1234.5678, 0) FROM DUAL;

TRUNC(1234.5678,0)
------------------
              1234

SQL> SELECT TRUNC(1234.5678, -1) FROM DUAL;

TRUNC(1234.5678,-1)
-------------------
               1230

SQL> SELECT TRUNC(1234.5678, -2) FROM DUAL;

TRUNC(1234.5678,-2)
-------------------
               1200

SQL> SELECT TRUNC(1234.5678, -3) FROM DUAL;

TRUNC(1234.5678,-3)
-------------------
               1000

 








Related examples in the same category

1.TRUNC(x [, y]) Returns the result of truncating x an optional y decimal places
2.TRUNC() returns its argument truncated to the number of decimal places specified with the second argument.
3.The value 109.29 was truncated to the single digit on the left side of the decimal point
4.TRUNC: Returns the truncated value (removes decimal part of a number, precision adjustable)
5.TRUNC with precision
6.TRUNC(44.647, 0)
7.TRUNC(44.647, -1)
8.TRUNC(Number,1): truncate values from a column
9.TRUNC(Number,-1)
10.select trunc( 12345.67890 )
11.select trunc( 12345.67890, 2 )
12.Use TRUNC in PL/SQL