Monday, July 23, 2012

MOD and MOD

Take note when you use MOD in either of these environment, especially if you need the fractional part of the final arithmetic.


Here's the behaviour of the MOD function in Oracle:


SQL> select mod(10.1,3) from dual ;

MOD(10.1,3)
-----------
1.1

SQL>




And here is how DB2 does it:

db2 => select mod(10.1,3) from sysibm.sysdummy1;

1
-----------
1

1 record(s) selected.




I shall emphasize that *BOTH* implementations are 'correct'.

No comments:

Post a Comment