MOD function returns the remainder of a number divided by another number.

**Syntax:**

select MOD(m,n) from dual;

It is the mathematical expression **m MOD n**.

m MOD n returns remainder of m divided by n.

Mathematical Explanation :-

m ≡ b (mod n) means (m – b) is divisible by n where b is an integer.

12 ≡ 2 (mod 5) means (12 -2) is divisible by 5. ie 10 is divisible by 5.

12 ≡ 0 ( mod 12) means (12 – 0) is divisible by 12.

**Examples :-**

1) select MOD(10,3) from dual;

MOD(10,3)

—————

1

2) select MOD(3,0) from dual;

MOD(3,0)

—————

3

2) select MOD(3,5) from dual;

MOD(3,5)

—————

3

Some more examples

MOD(5,2) | 1 |

MOD(5,0) | 5 |

MOD(5,5) | 0 |

MOD(2,5) | 2 |

MOD(-2,5) | -2 |

MOD(5,-1) | 1 |

MOD(5,0.5) | 0 |

MOD(5,1.2) | 0.2 |

Oracle has introduced another function REMAINDER in 10g version. Note that MOD and REMAINDER function looks similar but not exactly. Explained in another post.