नोट
इस पेज तक पहुँच के लिए प्रमाणन की आवश्यकता होती है. आप साइन इन करने या निर्देशिकाओं को बदलने का प्रयास कर सकते हैं.
इस पेज तक पहुँच के लिए प्रमाणन की आवश्यकता होती है. आप निर्देशिकाओं को बदलने का प्रयास कर सकते हैं.
Applies to:
Databricks SQL
Databricks Runtime
Returns dividend divided by divisor.
Syntax
dividend / divisor
Arguments
dividend: A numeric orINTERVALexpression.divisor: A numeric expression.
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 dividend is a day-time interval, the result is an INTERVAL DAY TO SECOND.
In all other cases, a DOUBLE.
If the divisor is 0, Azure Databricks raises a DIVIDE_BY_ZERO error.
If the dividend is an interval and the divisor is 0, Azure Databricks raises an INTERVAL_DIVIDED_BY_ZERO error.
If the result overflows the result type, Azure Databricks raises an ARITHMETIC_OVERFLOW or INTERVAL_ARITHMETIC_OVERFLOW error.
Use try_divide to return NULL instead.
Note
In Databricks Runtime, if spark.sql.ansi.enabled is false, the function returns NULL instead of a divide-by-zero error.
Common error conditions
Examples
> SELECT 3 / 2;
1.5
> SELECT 2L / 2L;
1.0
> SELECT INTERVAL '3:15' HOUR TO MINUTE / 3
0 01:05:00.000000
> SELECT 3 / 0;
Error: DIVIDE_BY_ZERO