Firebird Documentation IndexFirebird 2.1 Language Ref. UpdateInternal functions → TRUNC()
Firebird Home Firebird Home Prev: TRIM()Firebird Documentation IndexUp: Internal functionsNext: UPPER()

TRUNC()

Available in: DSQL, PSQL

Added in: 2.1

Description: Returns the integer part of a number. With the optional scale argument, the number can be truncated to powers-of-ten multiples (tens, hundreds, tenths, hundredths, etc.) instead of just integers.

Result type: INTEGER, (scaled) BIGINT or DOUBLE

Syntax: 

TRUNC (<number> [, <scale>])

<number>  ::=  a numerical expression
<scale>   ::=  an integer specifying the number of decimal places
               toward which should be truncated, e.g.:
                  2 for truncating to a multiple of 0.01
                  1 for truncating to a multiple of 0.1
                  0 for truncating to a whole number
                 -1 for truncating to a multiple of 10
                 -2 for truncating to a multiple of 100

Notes: 

Important

If you are used to the behaviour of the external function TRUNCATE, please notice that the internal function TRUNC always truncates toward zero, i.e. upward for negative numbers.

Prev: TRIM()Firebird Documentation IndexUp: Internal functionsNext: UPPER()
Firebird Documentation IndexFirebird 2.1 Language Ref. UpdateInternal functions → TRUNC()