Comparison Operators - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
Language
English (United States)
Last Update
2024-04-03
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905

The following table describes the comparison operators.

Operator Purpose
EQ or = Assume p1 and p2 are Period expressions and have comparable Period data types.

If BEGIN(p1) = BEGIN(p2) AND END(p1) = END(p2), the result of the comparison is TRUE; otherwise, the result is FALSE.

If either Period expression is NULL, the result is UNKNOWN.

If the Period expressions have different element types, one must be explicitly CAST as the other.

If one Period expression has a Period data type and the other Period expression has CHARACTER or VARCHAR data type, the CHARACTER or VARCHAR expression is implicitly converted, before comparison, to the data type of the Period expression based on the format of the Period expression.

EQ supports comparisons between derived periods.

LT or < Assume p1 and p2 are Period expressions and have comparable Period data types.

If BEGIN(p1) < BEGIN(p2) OR (BEGIN(p1) = BEGIN(p2) AND END(p1) < END(p2)), the result of the comparison is TRUE; otherwise, the result is FALSE.

If either Period expression is NULL, the result is UNKNOWN.

If the Period expressions have different element types, one must be explicitly CAST as the other.

If one Period expression has a Period data type and the other Period expression has CHARACTER or VARCHAR data type, the CHARACTER or VARCHAR operand is implicitly converted, before comparison, to the data type of the Period expression based on the format of the Period expression.

If the ending bound value of a system-versioned system-time or temporal table transaction-time column is UNTIL_CLOSED, the ending bound value is only less than a TIMESTAMP column value or TIMESTAMP literal if the column value or literal is the maximum TIMESTAMP value with leap seconds. This can be possible only if the ending bound of the system-versioned system-time or transaction-time column is used in a comparison with the timestamp value.

LT supports comparisons between derived periods.

GT or > Assume p1 and p2 are Period expressions and have comparable Period data types.

If BEGIN(p1) > BEGIN(p2) OR (BEGIN(p1) = BEGIN(p2) AND END(p1) > END(p2)), the result of the comparison is TRUE. Otherwise, the result is FALSE.

If either Period expression is NULL, the result is UNKNOWN.

If one Period expression has a Period data type and the other Period expression has CHARACTER or VARCHAR data type, the CHARACTER or VARCHAR Period expression is implicitly converted, before comparison, to the data type of the Period expression based on the format of the Period expression.

GT supports comparisons between derived periods.

NE or <> or

NOT= or ^= or

LE or <= or

GE or >=

These comparison operators are supported for comparable Period expressions.

If one Period expression has a Period data type and the other Period expression has CHARACTER or VARCHAR data type, the CHARACTER or VARCHAR Period expression is implicitly converted, before comparison, to the data type of the Period expression based on the format of the Period expression.

NE, LE, and GE support comparisons between derived periods.