Quick Search:
 
 The Oracle PL/SQL MOD Function      [Return To Index] Jump to:  

Term: MOD

Definition:
The Oracle PL/SQL MOD (short for modulus) function returns the remainder when one argument is divided by the second argument. It accepts two number arguments and returns a single numeric value. The modulus is calculated according to the formula: x - y * floor(x/y).

Example Syntax:

MOD(x,y)


The remainder will be returned when 'x' is divided by 'y'

The mod function will return x if y is 0. If y = 0, it returns x.

Example Usage:

The SQL below returns the remainder when 10 is divided by 3 (leaving '1').

SQL> SELECT MOD(10,3) RES FROM DUAL;

RES
----------
1


The SQL below shows a case where the dividend is less than the divisor.

SQL> SELECT MOD(3,10) RES FROM DUAL;

RES
----------
3



Related Links:

Related Code Snippets:
 
   Home |    Search |    Code Library |    Sponsors |    Privacy |    Terms of Use |    Contact Us © 2003 - 2024 psoug.org