In Oracle/PLSQL, the remainder function returns the remainder of m divided by n.
Syntax
The syntax for the remainder function is:
remainder( m, n )
The remainder is calculated as:
m - (n * X) where X is the integer nearest m / n
Note
The remainder function uses the round function in its formula, whereas the mod function uses the floor function in its formula.
Applies To
- Oracle 11g, Oracle 10g
For Example
remainder(15, 6) | would return 3 |
remainder(15, 5) | would return 0 |
remainder(15, 4) | would return -1 |
remainder(11.6, 2) | would return -0.4 |
remainder(11.6, 2.1) | would return -1 |
remainder(-15, 4) | would return 1 |