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

MOD

Syntax

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

Purpose

The MOD SQL function gets the remainder of a divide calculation.

See also REMAINDER.

Parameters:

  • dividend (decimal): a number.
  • divider (decimal): a number other than 0; a divider of 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:

select mod(25, 7)

-------------------
4

The following example retrieves the remainder of -8 divided by 17; the sign of the dividend is kept:

select mod(-8, 17)

-------------------
-8

The following example retrieves the remainder of 10 divided by 10:

select mod(10, 10)

-------------------
0