Mod function

Mod(N,M) returns the remainder of N/M where both N And M are integers.


select mod(3,2) from dual;

create table TestTable(
      ID                 VARCHAR2(4 BYTE)         NOT NULL,
      MyNumber           Number(8,2)
    );

insert into TestTable (ID, MyNumber)values('1',12);
insert into TestTable (ID, MyNumber)values('1',1);
insert into TestTable (ID, MyNumber)values('1',1.1);

SQL> select myNumber from testTable;

  MYNUMBER
----------
        12
         1
       1.1

SQL> select mod(myNumber,2) from testTable;

MOD(MYNUMBER,2)
---------------
              0
              1
            1.1

SQL>
Home »
Oracle »
Numeric Functions » 

Related: