invantive documentationpart of invantive cloud
Invantive Support ForumsLog In / Sign Up

SIGN

Syntax

%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    Start((START)) --> SIGN[SIGN]:::quoted
    SIGN --> End((END))

Purpose

The SIGN SQL function returns the sign of a number, with -1 representing a negative number, 1 a positive number and 0 a zero.

See also ABS.

Parameters:

  • Input (decimal): A number.

Returns: the sign as an int32.

Examples

The following example retrieves the sign of a negative number, a zero and a positive number:

select sign(-0.65565) negative
,      sign(0) neutral
,      sign(+20) positive

-------- -------- --------
-1       0        1

The following example returns null since the input is null:

select sign(null)

--------