negate
This section contains reference documentation for the negate function.
Returns the negation of the input value. This is a polymorphic function that preserves the input numeric type.
negate(col) is equivalent to the unary minus operator -col. See Arithmetic Operators for operator syntax.
Signature
negate(col)
Argument
Type
Description
col
INT, LONG, FLOAT, DOUBLE, BIG_DECIMAL
Value to negate
Returns the same type as the input argument.
Usage Examples
SELECT negate(42.5) AS value
FROM myTablevalue
-42.5
SELECT negate(-10) AS value
FROM myTablevalue
10
SELECT negate(100) AS int_neg, negate(1000000L) AS long_neg, negate(3.14F) AS float_neg, negate(2.718) AS double_neg
FROM myTableReturns INT, LONG, FLOAT, DOUBLE respectively (preserving input type).
Last updated
Was this helpful?

