113. SIGN - llighter/database GitHub Wiki

SIGN Database SQL Language Reference

Syntax

Purpose

SIGN returns the sign of n. This function takes as an argument any numeric data type, or any nonnumeric data type that can be implicitly converted to NUMBER, and returns NUMBER.

For value of NUMBER type, the sign is:

  • -1 if n<0

  • 0 if n=0

  • 1 if n>0

Examples

The following example indicates that the argument of the function (-15) is <0:

SELECT SIGN(-15) "Sign" FROM DUAL;

      Sign
----------
        -1