SIGN

Returns the sign of the input expression.

Syntax

SIGN(numeric_expression double) → int

  • numeric_expression: Input expression.

Examples

SIGN example
SELECT SIGN(10.3)
-- 1

SIGN(numeric_expression int32) → int32

  • numeric_expression: Input expression.

Examples

SIGN example
SELECT SIGN(-5)
-- -1

SIGN(numeric_expression int64) → int64

  • numeric_expression: Input expression.

Examples

SIGN example
SELECT SIGN(24)
-- 1

SIGN(numeric_expression float) → int

  • numeric_expression: Input expression.

Examples

SIGN example
SELECT SIGN(0.0)
-- 0

Usage Notes

1 is returned if the input expression is positive. -1 is returned if the input expression is negative. 0 is returned if the input expression is 0.

Last updated