SIGN¶
The SIGN function is used to determine the sign of a number. It takes one argument, which must be of the FLOAT type. The result will be of the INTEGER type and can be -1, 0, or 1.
Syntax¶
Examples¶
- Using the
SIGNfunction with integers:
- Using the
SIGNfunction with floats:
- Using the
SIGNfunction with zero:
- Using the
SIGNfunction with NULL:
Error Cases¶
- The
SIGNfunction requires the argument to be of FLOAT type:
SELECT SIGN('string') AS SIGN;
-- Error: FunctionRequiresFloatValue("SIGN")
SELECT SIGN(TRUE) AS sign;
-- Error: FunctionRequiresFloatValue("SIGN")
SELECT SIGN(FALSE) AS sign;
-- Error: FunctionRequiresFloatValue("SIGN")
- The
SIGNfunction takes exactly one argument: