/
(slash sign) operator
Applies to: Databricks SQL Databricks Runtime
Returns dividend
divided by divisor
.
Returns
If both dividend
and divisor
are DECIMAL
, the result is DECIMAL
.
If dividend
is a year-month interval, the result is an INTERVAL YEAR TO MONTH
.
If divident
is a day-time interval, the result is an INTERVAL DAY TO SECOND
.
In all other cases, a DOUBLE
.
If the divisor
is 0, the operator returns a DIVIDE_BY_ZERO error.
Use try_divide to return NULL
on division-by-zero.
Note
In Databricks Runtime, if spark.sql.ansi.enabled is false
, the function returns NULL
instead of a divide-by-zero error.