SIGN Function in Oracle SQL – PLSQL

The SIGN function in Oracle SQL / PLSQL is used to get a value which indicates the sign of a number.

Syntax for the SIGN function in Oracle SQL / PLSQL is:

SELECT SIGN(N)
FROM table_name;

  • N is the number whose SIGN is to be determined.
  • If N >0 then 1 is returned
  • If N = 0 then 0 is returned
  • If N< 0 then -1 is returned

Example 1:

SELECT SIGN(1.23456)
FROM DUAL; 

Will return “1”


Example 2:

SELECT SIGN(0)
FROM DUAL;

Will return “0”


Example 3:

SELECT SIGN(-2.051)
FROM DUAL;

Will return “-1”


Tagged , , , , , , , , , , , . Bookmark the permalink.