SIGN Function

Returns a number that indicates the sign of a numeric value expression.

Category: Mathematical
Returned data type: TINYINT

Syntax

SIGN(expression)

Arguments

expression

specifies any valid SQL expression that evaluates to a numeric value.

Data type BIGINT, DOUBLE, FLOAT, INTEGER, REAL, SMALLINT, TINYINT
See <sql-expression>
FedSQL Expressions

Details

The SIGN function returns the following values:
-1
if expression < 0
0
if expression = 0
1
if expression > 0

Example

The following statements illustrate the SIGN function:
Statements
Results
select sign(-5);
-1
select sign(5);
1
select sign(0);
0