Apache Hive : HPL/SQL - Subtraction Operator (-)

Last updated: August 12, 2026

Apache 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:

ExpressionResultResult Type
3 - 12Integer

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.

Example:

ExpressionResultResult Type
DATE ‘2015-01-01’ - 1DATE ‘2014-12-31’DATE