Skip to content

Arithmetic Operators

Arithmetic operators are used to perform mathematical operations on one or more input arguments.

Input arguments are expected to be numeric values, except in the following cases:

  • The unary + operator implicitly converts text inputs to the corresponding numeric value if possible. If the conversion fails, an error is returned.
  • The binary - operator can also be applied to TIMESTAMP inputs.

This section covers the following topics:

Overview Table of Arithmetic Operators

OperatorSyntaxNotes
+ (unary)+aReturns the result of an implicit conversion of a to a numeric value. If conversion is not possible, an error is returned.
+a + bAdds two numeric input arguments a and b.
- (unary)-bNegates the numeric input argument.
-a - b
  • Subtracts the numeric input b from a.
  • If both a and b are TIMESTAMP values, returns the difference in days as an integer. This is the only arithmetic operation allowed for TIMESTAMP values.
*a * bMultiplies the numeric input arguments a and b.
/a / bDivides a by b.
%a % bReturns the remainder (modulo) of dividing a by b. (See also MOD)