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

REMAINDER

Syntax

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

Purpose

The REMAINDER SQL function uses the round function in its formula, whereas the MOD function uses the floor function in its formula.

See also MOD.

Parameters:

  • Number1 (decimal): a number.
  • Number2 (decimal): a number other than 0; 0 raises an error, as a division by 0 does.

Returns: the remainder.

Examples

The following example retrieves the remainder of 25 divided by 7; since 25 / 7 rounds to 4, the remainder is 25 - 4 * 7:

select remainder(25, 7)

-------------------
-3

The following example retrieves the remainder of 1 divided by 2:

select remainder(1, 2)

-------------------
1