Athugasemd
Aðgangur að þessari síðu krefst heimildar. Þú getur prófað aðskrá þig inn eða breyta skráasöfnum.
Aðgangur að þessari síðu krefst heimildar. Þú getur prófað að breyta skráasöfnum.
Applies to: Databricks SQL
Databricks Runtime 15.3 and later
Returns the remainder after dividend / divisor
or NULL
ifdivisor
is 0
.
try_mod(dividend, divisor)
dividend
: An expression that evaluates to a numeric.divisor
: An expression that evaluates to a numeric.
If both dividend
and divisor
are of DECIMAL
, the result matches the divisor’s type.
In all other cases, a DOUBLE
.
If divisor
is 0, the function returns NULL
. To raise DIVIDE_BY_ZERO error instead use the mod() function.
> SELECT try_mod(2, 1.8);
1.2
> SELECT try_mod(2, 0);
NULL