description |
---|
Rounds the input expression down the nearest of equal integer depending on the specified number of places before or after the decimal point. |
- numeric_expression: The numeric expression to truncate.
Examples
{% code title="TRUNCATE example" %}
SELECT TRUNCATE(987.65)
-- 987
{% endcode %}
- numeric_expression: The numeric expression to truncate.
Examples
{% code title="TRUNCATE example" %}
SELECT TRUNCATE(987.87)
-- 987
{% endcode %}
- numeric_expression: The numeric expression to truncate.
Examples
{% code title="TRUNCATE example" %}
SELECT TRUNCATE(2021)
-- 2021
{% endcode %}
- numeric_expression: The numeric expression to truncate.
Examples
{% code title="TRUNCATE example" %}
SELECT TRUNCATE(2021)
-- 2021
{% endcode %}
- numeric_expression: The numeric expression to truncate.
- scale_expression: sample parameter description
Examples
{% code title="TRUNCATE example" %}
SELECT TRUNCATE(89.2283211, 2)
-- 89.22
{% endcode %}
- numeric_expression: The numeric expression to truncate.
- scale_expression: sample parameter description
Examples
{% code title="TRUNCATE example" %}
SELECT TRUNCATE(2021, -1)
-- 2020
{% endcode %}
- numeric_expression: The numeric expression to truncate.
Examples
{% code title="TRUNCATE example" %}
SELECT TRUNCATE(9.7)
-- 9
{% endcode %}
- numeric_expression: The numeric expression to truncate.
- scale_expression: The decimal place to round to.
Examples
{% code title="TRUNCATE example" %}
SELECT TRUNCATE(78.9823, 2)
-- 78.98
{% endcode %}
- numeric_expression: The numeric expression to truncate.
- scale_expression: The decimal place to round to.
Examples
{% code title="TRUNCATE example" %}
SELECT TRUNCATE(4356, -2)
-- 4300
{% endcode %}
- numeric_expression: The numeric expression to truncate.
- scale_expression: The decimal place to round to.
Examples
{% code title="TRUNCATE example" %}
SELECT TRUNCATE(987.65, 1)
-- 987.6
{% endcode %}
To round to a place after the decimal point, specify the position as a positive number. To round to a place before the decimal point, specify the position as a negative number. To round to the nearest whole number, specify 0. If no decimal position is specified, then the function rounds to the nearest whole number (assumes 0 as the scale expression).