MOD (m,n)

Returns the remainder left over when m is divided by n.


SQL> SELECT MOD(18,12), MOD(30,12), MOD(30,30) 
  2  FROM dual;

MOD(18,12) MOD(30,12) MOD(30,30)
---------- ---------- ----------
         6          6          0

In the first case, 12 goes into 18 once with 6 left over. In the second case, 12 goes into 30 twice, but still with 6 left over. In the final case, 30 goes into 30 evenly, and nothing is left over.

Get Oracle SQL: the Essential Reference now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.