All Products
Search
Document Center

SIGN

Last Updated: Jun 18, 2021

The SIGN function returns the sign of the number n. If n is greater than 0, 1 is returned. If n is smaller than 0, -1 is returned. If n is equal to 0, 0 is returned.

Syntax

SIGN (n)

Parameters

ParameterDescription

n

The expression of the exact numeric data types or the approximate numeric data types: NUMBER, FLOAT, BINARY_FLOAT, and BINARY_DOUBLE.

Return type

The numeric values 0, 1, and -1 are returned.

Examples

This example shows the results of using the SIGN function for three different numbers.

Execute the following statement:

SELECT SIGN(100), SIGN(-100), SIGN(0) FROM DUAL;

The following query result is returned:

+-----------+------------+---------+
| SIGN(100) | SIGN(-100) | SIGN(0) |
+-----------+------------+---------+
|         1 |         -1 |       0 |
+-----------+------------+---------+