Oracle / PLSQL: REMAINDER Function

This article is written about how to use the Oracle/PLSQL REMAINDER feature with syntax and examples.

Description

The Oracle/PLSQL REMAINDER feature returns the the rest of m divided by means of n.

Syntax

The syntax for the REMAINDER characteristic in Oracle/PLSQL is:

REMAINDER( m, n )

Parameters or Arguments

m A numeric value used in the calculation. n A numeric value used in the calculation.

Calculation

The REMAINDER is calculated as follows:

m - (n * X)

where X is the integer nearest m / n

Note

See also the MOD function.

Returns

The REMAINDER function returns a numeric value.

Applies To

The REMAINDER characteristic can be used in the following variations of Oracle/PLSQL:

Oracle 12c, Oracle 11g, Oracle 10g

Example

Let’s look at some Oracle REMAINDER feature examples and discover how to use the REMAINDER function in Oracle/PLSQL.

For example:

REMAINDER(15, 6)
Result: 3

REMAINDER(15, 5)
Result: 0

REMAINDER(15, 4)
Result: -1

REMAINDER(11.6, 2)
Result: -0.4

REMAINDER(11.6, 2.1)
Result: -1

REMAINDER(-15, 4)
Result: 1