개인적인 정리

[Oracle] MOD() 본문

DB/ORACLE

[Oracle] MOD()

yeon.Biju 2020. 4. 9. 18:22

오라클 MOD()

 

MOD()

   - 

 

MOD(n2, n1)

의 형태

 

MOD returns the remainder of n2 divided by n1. Returns n2 if n1 is 0.

 

This function takes as arguments any numeric data type or any nonnumeric data type that can be implicitly converted to a numeric data type. Oracle determines the argument with the highest numeric precedence, implicitly converts the remaining arguments to that data type, and returns that data type.

 

SQL> SELECT MOD(11, 4) FROM DUAL ;

   --> 3

 

 

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

 

n2 -n1 * FLOOR(n2/n1)

 

 

 

'DB > ORACLE' 카테고리의 다른 글

[Oracle] NEXT_DAY()  (0) 2020.04.10
[Oracle] NCHR()  (0) 2020.04.10
[Oracle] NANVL()  (0) 2020.04.10
[Oracle] MONTHS_BETWEEN()  (0) 2020.04.10
[Oracle] MIN()  (0) 2020.04.09
[Oracle] MEDIAN()  (0) 2020.04.09
[Oracle] MAX()  (0) 2020.04.09
[Oracle] LTRIM()  (0) 2020.04.08
Comments