VeloDB Cloud
SQL Reference
SQL Functions
Scalar Functions
Numeric Functions
NEGATIVE

NEGATIVE

Description

Returns the negative value of the parameter x.

Syntax

NEGATIVE(<x>)

Parameters

ParameterDescription
<x>The independent variable supports the types BIGINT, DOUBLE, and DECIMAL

Return value

Returns an integer or a floating-point number. Special cases:

  • If the parameter is NULL, return NULL.
  • If the parameter is 0, return 0.

Example

SELECT negative(-10);
+---------------+
| negative(-10) |
+---------------+
|            10 |
+---------------+
SELECT negative(12);
+--------------+
| negative(12) |
+--------------+
|          -12 |
+--------------+
SELECT negative(0);
+-------------+
| negative(0) |
+-------------+
|           0 |
+-------------+
SELECT negative(null);
+----------------+
| negative(NULL) |
+----------------+
|           NULL |
+----------------+