Quick Search:
CODE
Oracle PL/SQL Code Library
JOBS
Find Or Post Oracle Jobs
FORUM
Oracle Discussion & Chat
 The Oracle PL/SQL MOD Function      [Return To Index] Jump to:  
  Looking for the original pages? (formerly called "Morgan's Library") You can find them here.

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      :      Code Library      :      Sponsors      :      Privacy      :      Terms of Use      :      Contact Us 64 users online    © 2009 psoug.org
PSOUG LOGIN
Username: 
Password: 
Forgot your password?