Documentation Invantiveune partie de Invantive cloud
Forums d'Invantive SupportConnectez-vous/inscrivez-vous

SIGN

Syntaxe

%%{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))

Objet

La fonction SQL SIGN renvoie le signe d'un nombre, -1 représentant un nombre négatif, 1 un nombre positif et 0 zéro.

Voir également ABS.

Paramètres :

  • Entrée (decimal) : un nombre.

Résultats : le signe sous la forme d'un int32.

Exemples

L'exemple suivant permet d'obtenir le signe d'un nombre négatif, d'un zéro et d'un nombre positif :

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

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

L'exemple suivant renvoie null, car l'élément d'entrée est null :

select sign(null)

--------