TRUNCATE
The TRUNCATE function removes decimal places from a number, leaving a specified number of decimal places.
You can use TRUNCATE with a second argument to truncate a number to a specified number of decimal places or without a second argument to reduce a number to an integer by removing all decimal places.
- Syntax:
- TRUNCATE (single-number-expression[ , single-integer-expression ] )
- Meaning:
- TRUNCATE (number_to_truncate[ , number_of_decimal_places ] )
- Returns:
- A single number
TRUNCATE first converts number_to_truncate to character format, if necessary. It then truncates that number by removing decimal places to the right of number_of_decimal_places. If number_of_decimal_places is not used, the number is truncated to an integer.
Examples
- TRUNCATE ( 3.9292, 2 )
Returns 3.92
- TRUNCATE ( 3.9292 )
Returns 3
Related functions
- INT
- ROUND