This is an old revision of the document!


DRAFT

Omnidex SQL Function: $TRUNC

Description

The $TRUNC function returns a numeric expression truncated to a specified number of digits to the right of the decimal point.

If the value specified by n is positive and longer than the digits after the decimal point, 0 is added after the fraction digits.

If the value specified by n is negative and larger than or equal to the digits before the decimal point, 0 is returned.

When a numeric expression is truncated, the trailing digits are simply dropped off. The return value is not rounded in any way.

Syntax

TRUNC(expression [,n])

expression Required. The numerical expression that is to be truncated.

n Optional. n is an integer indicating the number of digits to display after the decimal point.

Example

Example 1

$TRUNC(123.4545, 2) result: 123.45

$TRUNC(123.4545, -2) result: 100

$TRUNC(123.9994, 3) result: 123.999

$TRUNC(123.9995, 3) result: 123.999

 
Back to top
dev/sql/functions/trunc.1260196738.txt.gz ยท Last modified: 2016/06/28 22:38 (external edit)