René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback
 

mod [Oracle SQL]

mod(m,n)
mod (=modulus) returns the reminder of m devided by n. If m = 0, it returns 0, if n = 0, it returns m.
create table mod_exp (
  m number(2),
  n number(2)
);
insert into mod_exp values (   10,    7);
insert into mod_exp values (    0,    9);
insert into mod_exp values ( null,    9);
insert into mod_exp values (    8, null);
insert into mod_exp values (    4,    0);
insert into mod_exp values (    2,    5);
insert into mod_exp values (   60,   22);
select m, n, mod(m,n) mod from mod_exp;
         M          N        MOD
---------- ---------- ----------
        10          7          3
         0          9          0
                    9
         8
         4          0          4
         2          5          2
        60         22         16

Thanks

Thanks to Sumit Taraphdar for a correction on this page.