- (minus sign) unary operator (Databricks SQL)

Returns the negated value of expr.

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.

This function is a synonym for negative function (Databricks SQL).

Examples

> SELECT -(1);
 -1

> SELECT -(cast(-32768 AS smallint));
 Error: ARITHMETIC_OVERFLOW

> SELECT -INTERVAL '5' MONTH;
 -0-5