Numerical Functions

ABS

Syntax

ABS(x)

Description

The ABS function the returns absolute value of the number specified by the x parameter.

Example

ABS(WEIGHT) > 100

Absolute value of the WEIGHT field is to be more than 100.

MOD

Syntax

MOD(x, y)

Description

The MOD function returns the remainder in division of x by y. If y=0, the x value is returned.

Example

MOD(VAL,VAL2) = 0

The value of the VAL field is to be divided by the value of the VAL2 field without a remainder.

ROUND

Syntax

ROUND(x[, y])

Description

The ROUND function returns the x value rounded off to y positions on the right-hand side of the decimal point. By default, y=0 and x is rounded off to the nearest integer. If y is a negative number, the figures on the left-hand side of the decimal point are rounded. The y parameter should be an integer.

Example

ROUND(VAL, 2) > 10.55

The value of the Val field rounded to two positions to the right of the decimal point should be more than 10.55.

SIGN

Syntax

SIGN(x)

Description

The SIGN function defines sign of the value specified as the x parameter. If x < 0, the returned value is -1. If x = 0, the function returns 0. If x > 0, the function returns 1.

Example

SIGN(VAL) = 1

The value of the Val field should be positive.

TRUNC

Syntax

TRUNC(x[, y])

Description

The TRUNC functions returns the x value truncated (not rounded) to the y decimal positions. By default, y = 0 and x is truncated to the integer. If y is a negative number, the figures on the left-hand side of the decimal point are truncated.

Example

TRUNC(VAL, 2) > 10.55

The value of the Val field truncated to two positions to the right of the decimal point should be more than 10.55.

See also:

Built-in SQL Functions | Table Constraints