Adsense Ad

Saturday 13 May 2017

Oracle PLSQL: REMAINDER Function

REMAINDER Function

This Oracle tutorial explains how to use the Oracle/PLSQL REMAINDER function with syntax and examples.

Description

The Oracle/PLSQL REMAINDER function returns the remainder of m divided by n.

Syntax

The syntax for the REMAINDER function 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

Applies To

The REMAINDER function can be used in the following versions of Oracle/PLSQL:
  • Oracle 12c, Oracle 11g, Oracle 10g

Example

Let's look at some Oracle REMAINDER function examples and explore 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

No comments: