Skip to main content

Overview

The SIGN() function returns a sign of an argument. The returned values are -1 if the argument is less than zero, 1 if the argument is greater than zero, 0 if the argument is equal to zero.

Syntax

The syntax for the SIGN() function is as follows:
The SIGN() function requires one argument:
  • x: an expression that evaluates to a number.

Examples

Case #1: Sign of a number

The following example demonstrates how the SIGN() function can be used to obtain the sign of a number:
The query will return the signs of the passed arguments:
Note: -0 is accepted as an argument and is equal to zero

Case #2: SIGN() function with an expression

The following example demonstrates how the SIGN() function can be used with an expression:
will return the sign of the expression evaluation:

Case #3: Using the SIGN() function with a table

The following example demonstrates how the SIGN() function can be used with a table to obtain the absolute values of all numbers in a specific column:
  1. Create a table signTable containing an value column with some positive, negative and equal to zero values:
  1. Use the following query to find the sign of all inserted values:
  1. The result will be as follows::