-
(minus sign) unary operator
Returns the negated value of expr
. This function is a synonym for negative function.
Syntax
- expr
Arguments
expr
: An expression that evaluates to a numeric or interval.
Returns
The result type matches the argument type.
For integral numeric types the function can return an ARITHMETIC_OVERFLOW error.
Warning
In Databricks Runtime, if spark.sql.ansi.enabled is false
, an overflow does not cause an error but “wraps” the result instead.
Examples
> SELECT -(1);
-1
> SELECT -(cast(-32768 AS smallint));
Error: ARITHMETIC_OVERFLOW
> SELECT -INTERVAL '5' MONTH;
-0-5
Related functions
Feedback
https://aka.ms/ContentUserFeedback.
Kommer snart: I hele 2024 udfaser vi GitHub-problemer som feedbackmekanisme for indhold og erstatter det med et nyt feedbacksystem. Du kan få flere oplysninger under:Indsend og få vist feedback om