MOD

Returns the remainder when the the first argument (the dividend is divided by the second numeric argument (the divisor). If the divisor is zero, a divide by zero error is raised.

Syntax

MOD ( < - dividend>, < - divisor> )
<dividend> := < - integer-expression>
 <divisor>  := < - integer-expression>

Examples

Function Result
MOD(4,2) 0
MOD(5,3) 2
MOD(-4,3) -1
MOD(5,12) 5

Limitations

The SQLstream MOD function only supports arguments of scale 0 (integers). This is a departure from the SQL standard, which supports any numeric argument. Other numeric arguments can be CAST to an integer, of course.