Operators
Apache Hive : HPL/SQL - Addition Operator (+)
Aug 12, 2026Apache Hive : HPL/SQL - Addition Operator (+)
You can use + arithmetic operator to add two numbers, concatenate two strings, or add an interval to a DATE value.
Syntax:
expr + expr
Add Two Integers
When you add two integer values the result of the operation also has an integer value.
Example:
| Expression | Result | Result Type |
|---|---|---|
| 3 + 1 | 4 | Integer |
Concatenate Two Strings
When you use + for string operand the result of the operation is the concatenated string.
Apache Hive : HPL/SQL - Equality and Comparison Operators
You can use equality and comparison operators =, ==, <>, !=, <, >, >=, <= to determine if one operand is equal, not equal, less or greater than another operand.
| = | == | Equal |
| <> | != | Not equal |
| > | Greater than | |
| < | Less than | |
>= | Greater than or equal | |
<= | Less than or equal |
Syntax:
Apache Hive : HPL/SQL - String Concatenation ||
Aug 12, 2026Apache Hive : HPL/SQL - String Concatenation ||
You can use || operator to concatenate two or more strings.
Syntax:
expr || expr [|| expr ...]
The result of the operation is always a string. If an operand is a number, it is implicitly converted to string before concatenation.
If an operand is NULL, it is treated as an empty string ’’ in the concatenation. If all operands are NULL, the result is NULL.
Apache Hive : HPL/SQL - Subtraction Operator (-)
Aug 12, 2026Apache Hive : HPL/SQL - Subtraction Operator (-)
You can use (-) arithmetic operator to subtract two numbers, or subtract the number of days from a DATE value.
Syntax:
expr - expr
Subtract Two Integers
When you subtract two integer values the result of the operation also has an integer value.
Example:
| Expression | Result | Result Type |
|---|---|---|
| 3 - 1 | 2 | Integer |
Subtract Integer from Date
When you subtract an integer from a DATE value, HPL/SQL subtracts the number of days from the DATE and the result of the operation is a DATE value.