IntAdd (NoSQL query)

APPLIES TO: NoSQL

Adds the value of the right-hand operand to the left-hand operand. For more information, see additive operators.

Syntax

IntAdd(<int_expr_1>, <int_expr_2>)

Arguments

Description
int_expr_1 An integer expression, which is used as the left-hand operand.
int_expr_2 An integer expression, which is used as the right-hand operand.

Return types

Returns a 64-bit integer.

Note

For more information, see __int64.

Examples

This example tests the function with various static values.

SELECT VALUE {
    addNumber: IntAdd(20, 10),
    addZero: IntAdd(20, 0),
    addDecimal: IntAdd(20, 0.10)
}
[
  {
      "addNumber": 30,
      "addZero": 20
  }
]

Remarks

  • This function expects integers for both arguments and performs operations assuming the values are a 64-bit integer.
  • If any of the arguments aren't an integer, the function returns undefined.
  • Overflow behavior is similar to the implementation in C++ (wrap-around).

See also