Function group: numeric function
MOD() determines the remainder of a division of two integers.
MOD (
dividend, divisor )
dividend ::=
expression
divisor ::=
expression
dividend
Integer numeric expression (SMALLINT, INTEGER, NUMERIC(p,0), DECIMAL(p,0)) for the dividend of the division.
divisor
Integer numeric expression (SMALLINT, INTEGER, NUMERIC(q,0), DECIMAL(q,0)) for the divisor of the division. divisor may not be 0.
dividend and divisor may not be multiple values with a dimension > 1.
Result
When dividend or divisor returns the NULL value, the result is the NULL value.
When dividend returns the value 0, the result is 0.
Otherwise:
The result is the integer remainder of the division dividend / divisor with the same sign as dividend.
Data type: like divisor.
Examples
MOD (3,2)
returns the value 1.
MOD (-3,-2)
returns the value -1.