Oracle9i SQL Reference
Release 1 (9.0.1)

Part Number A90125-01
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback

Go to previous page Go to beginning of chapter Go to next page

Functions, 70 of 166


MOD

Syntax

mod::=


Text description of functions165a.gif follows
Text description of mod

Purpose

MOD returns the remainder of m divided by n. Returns m if n is 0.

Example

The following example returns the remainder of 11 divided by 4:

SELECT MOD(11,4) "Modulus" FROM DUAL;

   Modulus
----------
         3

This function behaves differently from the classical mathematical modulus function when m is negative. The classical modulus can be expressed using the MOD function with this formula:

m - n * FLOOR(m/n)

The following table illustrates the difference between the MOD function and the classical modulus:

M  N  MOD(M,N)  Classical Modulus 

11 

4 

3 

3 

11 

-4 

3 

-1 

-11 

4 

-3 

1 

-11 

-4 

-3 

-3 

See Also:

FLOOR 


Go to previous page Go to beginning of chapter Go to next page
Oracle
Copyright © 1996-2001, Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback