This function is used to truncate the number value to a specified decimal place.
trunc_numeric(<number>[, bigint<decimal_places>])
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
number |
Yes |
DOUBLE, BIGINT, DECIMAL, or STRING |
Data to be truncated |
decimal_places |
No |
BIGINT |
The default value is 0, indicating that the decimal place at which the number is truncated. |
The return value is of the DOUBLE or DECIMAL type.
The return rules are as follows:
The value 3.141 is returned.
select trunc_numeric(3.1415926, 3);
The value 3 is returned.
select trunc_numeric(3.1415926);
An error is reported.
select trunc_numeric(3.1415926, 3.1);