Home

Getting Started

Utilities

Indexing

Omnidex

Development

Tutorials

Quick Links

 

SQL Reference

Functions

Syntax

Example

 

SQL Reference

Joins

Nested Queries

Set Operations

ON CURSOR | INSTANCE

WITH Options

Commands

Functions

 

$TRUNC

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

$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

Top