Oracle/PLSQL: Sign Function
In Oracle/PLSQL, the sign function returns a value indicating the sign of a number.
Syntax
The syntax for the sign function is:
sign( number )
number is 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
- Oracle 11g, Oracle 10g, Oracle 9i, Oracle 8i
For Example
| sign(-23) | would return -1 |
| sign(-0.001) | would return -1 |
| sign(0) | would return 0 |
| sign(0.001) | would return 1 |
| sign(23) | would return 1 |
| sign(23.601) | would return 1 |