TRUNC
Truncates a numeric value toward zero at the requested scale.
Category: Numeric Functions
Syntax
TRUNC(num, [scale...])TRUNC(value, unit)Arguments
- num
numberNumeric value to truncate. - scale
integer[optional | variadic] Decimal scale to keep before truncating toward zero. Optional. Can be repeated. - value
temporalDate, time, or timestamp value to truncate. - unit
varchar[constant] Granularity to truncate to, such asday,month, oryear. Must be a constant expression.
Returns
FLOAT — Returns the computed result as FLOAT.
TIMESTAMP[US] — Returns the computed result as TIMESTAMP[US].
Usage Notes
Truncation is performed toward zero rather than toward negative infinity.
Truncates to the start of the specified unit. The unit argument must be a constant expression. This overload is reachable only for a DATE LITERAL, which is constant-folded at plan time: over a DATE COLUMN there is no native kernel and the call is refused with "outside the c-native kernel set". Cast the column to TIMESTAMP to truncate it.
Truncates to the start of the specified unit. The unit argument must be a constant expression.