REMAINDER function in Oracle

REMAINDER is one of the vital Numeric/Math functions of Oracle. It is used to get the remainder of x divided by y. The REMAINDER function is supported in the various versions of the Oracle/PLSQL, including, Oracle 12c, Oracle 11g and Oracle 10g.

Syntax:

REMAINDER ( x, y )

Parameters:
x, y: They are used to specify the numbers to be used for calculation.

Example 1:

REMAINDER (10, 2)

Output:

0

Explanation:
The REMAINDER is calculated as [x – (y * n)], where n is the integer nearest to (x/y), here n = 5.

Example 2:

REMAINDER (10, 3)

Output:

1

Explanation:
The REMAINDER is calculated as [x – (y * n)], where n is the integer nearest to (x/y), here n = 3.

Example 3:

REMAINDER (10, 6)

Output:

-2

Explanation:
The REMAINDER is calculated as [x – (y * n)], where n is the integer nearest to (x/y), here n = 2.