MOD

Click to skip syntax diagram
Read syntax diagramSkip visual syntax diagram>>-MOD--(--expression-1--,--expression-2--)--------------------><
 

The MOD function divides the first argument by the second argument and returns the remainder.

The formula used to calculate the remainder is:

  MOD(x,y) = x - (x/y) * y

where x/y is the truncated integer result of the division. The result is negative only if first argument is negative.

expression-1
The argument must be an expression that returns a value of any built-in numeric, character-string, or graphic-string data type. A string argument is cast to double-precision floating point before evaluating the function. For more information on converting strings to double-precision floating point, see DOUBLE_PRECISION or DOUBLE.
expression-2
The argument must be an expression that returns a value of any built-in numeric, character-string, or graphic-string data type. A string argument is cast to double-precision floating point before evaluating the function. For more information on converting strings to double-precision floating point, see DOUBLE_PRECISION or DOUBLE. expression-2 cannot be zero.

If an argument can be null, the result can be null; if an argument is null, the result is the null value.

The attributes of the result are determined as follows:

Examples