ORACLE/PLSQL: SIGN FUNCTION

This Oracle tutorial explains how to use the Oracle/PLSQL SIGN function with syntax and examples.

DESCRIPTION

The Oracle/PLSQL SIGN function returns a value indicating the sign of a number.

SYNTAX

The syntax for the SIGN function in Oracle/PLSQL is:
SIGN( number )

Parameters or Arguments

number
The number to test for its sign.
Note:
If number < 0, then sign returns -1.
If number = 0, then sign returns 0.
If number > 0, then sign returns 1.

APPLIES TO

The SIGN function can be used in the following versions of Oracle/PLSQL:
  • Oracle 12c, Oracle 11g, Oracle 10g, Oracle 9i, Oracle 8i

EXAMPLE

Let's look at some Oracle SIGN function examples and explore how to use the SIGN function in Oracle/PLSQL.
For example:
SIGN(-23)
Result: -1

SIGN(-0.001)
Result: -1

SIGN(0)
Result: 0

SIGN(0.001)
Result: 1

SIGN(23)
Result: 1

SIGN(23.601)
Result: 1
Share on Google Plus

About Mindsforest

    Blogger Comment
    Facebook Comment

1 comments: