MOD
MOD (m,n)

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

Example

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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.