Product Documentation

SQL Reference Guide

Previous Topic

Next Topic

TRUNCATE function

Syntax

TRUNCATE( number, length )

Description

The scalar function truncates number to length decimal places.

If value of length is positive, number is truncated to the length of places to the right of the decimal point.

If length is negative, number is truncates to positive value of length places to the left of decimal point

Arguments

  • number - This is an expression of an exact numeric or approximate numeric data type.
  • length - Is the precision to which number is truncated.

Example

SELECT price, TRUNCATE(price, 1), TRUNCATE(price, -1)

FROM custorder;

PRICE TRUNCATE( TRUNCATE(

----- --------- ---------

1546.56 1546.50 1540.00

TOCIndex