Skip to main content
Returns the sign of a numeric value: -1 for negative values, 0 for zero, and 1 for positive values.

Syntax

Parameters

ParameterDescriptionSupported input types
<value>The value whose sign is returned.DOUBLE PRECISION, REAL, INTEGER, BIGINT, NUMERIC

Return Type

Same type as the input <value>.

Remarks

  • SIGN(NULL) returns NULL.
  • SIGN('NaN'::DOUBLE PRECISION) returns 0, matching PostgreSQL semantics — NaN is neither positive nor negative.
  • SIGN('Infinity'::DOUBLE PRECISION) returns 1.
  • SIGN('-Infinity'::DOUBLE PRECISION) returns -1.

Example

The following example returns the sign of several values:
negative doublezero intpositive int
-101

Rows: 1Execution time: 2.30ms