In this tutorial we will explain how to use the Oracle PL/SQL SIGN function with syntax and examples
SIGN Function :
SIGN Function :
Syntax : SIGN(input_number) ;
- In Oracle PL/SQL , SIGN is a inbuilt function which is used to determine the sign of a give number.
- Returns -1 if input_number is < 0
- Returns 1 if input_number is > 0
- Returns 0 if input_number is = 0
- Return type is number and is either -1 ,1 or 0.
EXAMPLE :1 (When Input number is < 0 )
SELECT SIGN(-100) FROM DUAL;
SIGN
--------------------
-1
EXAMPLE :2 ( When Input number is > 0) SELECT SIGN(143.12) FROM DUAL; SIGN -------------------- 1
EXAMPLE :3 (When Input number is = 0 ) SELECT SIGN(0) FROM DUAL; SIGN -------------------- 0
No comments:
Post a Comment
Please Provide your feedback here