Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Processing External Data →  ABAP Database Access →  ABAP SQL →  ABAP SQL - Operands and Expressions →  ABAP SQL - SQL Conditions sql_cond →  sql_cond - rel_exp for Statements →  sql_cond - Relational Operators 

sql_cond - Comparable Types

The following table shows which built-in data types in ABAP Dictionary can be compared with each other. The table applies to the following:

  • Comparisons of a WHERE condition or HAVING condition in which SQL expressions are specified on the left side (lhs) and columns are specified on the right side (rhs).
  • Comparisons of an ON condition.

Invalid comparisons produce a syntax error in conditions of an expression and in the strict mode from Release 7.40SP08 . In other cases, a syntax warning is produced. The result of invalid comparisons is determined by the database system and is not platform-independent.

lhs/rhs INT1 INT2 INT4 INT8 DEC CURR QUAN DECFLOAT16 DF16_DEC DF16_RAW DECFLOAT34 DF34_DEC DF34_RAW FLTP CHAR SSTRING NUMC CLNT LANG DATS TIMS ACCP UNIT CUKY DATN TIMN UTCLONG RAW
INT1 x x x x x x x x y - x y - - - - - - - - - - - - - - - -
INT2 x x x x x x x x y - x y - - - - - - - - - - - - - - - -
INT4 x x x x x x x x y - x y - - - - - - - - - - - - - - - -
INT8 x x x x x x x x y - x y - - - - - - - - - - - - - - - -
DEC x x x x x x x x y - x y - - - - - - - - - - - - - - - -
CURR x x x x x x x x y - x y - - - - - - - - - - - - - - - -
QUAN x x x x x x x x y - x y - - - - - - - - - - - - - - - -
DECFLOAT16 x x x x x x x x y - x y - - - - - - - - - - - - - - - -
DF16_DEC y y y y y y y y z - - y - - - - - - - - - - - - - - - -
DF16_RAW - - - - - - - - - x - - - - - - - - - - - - - - - - - -
DECFLOAT34 x x x x x x x x y - x y - - - - - - - - - - - - - - - -
DF34_DEC y y y y y y y y y - - z - - - - - - - - - - - - - - - -
DF34_RAW - - - - - - - - - - - - x - - - - - - - - - - - - - - -
FLTP - - - - - - - - - - - - - x - - - - - - - - - - - - - -
CHAR - - - - - - - - - - - - - - x x x x x x x y x x y y - -
SSTRING - - - - - - - - - - - - - - x x x x x e e y x x - - - -
NUMC - - - - - - - - - - - - - - x x x x x e e y x x - - - -
CLNT - - - - - - - - - - - - - - x x x x x e e y x x - - - -
LANG - - - - - - - - - - - - - - x x x x x e e y x x - - - -
DATS - - - - - - - - - - - - - - x e e e e x e - e e y - - -
TIMS - - - - - - - - - - - - - - x e e e e e x - e e - y - -
ACCP - - - - - - - - - - - - - - y y y y y - - y y y - - - -
UNIT - - - - - - - - - - - - - - x x x x x e e y x x - - - -
CUKY - - - - - - - - - - - - - - x x x x x e e y x x - - - -
DATN - - - - - - - - - - - - - - y - - - - y - - - - x - - -
TIMN - - - - - - - - - - - - - - y - - - - - y - - - - x - -
UTCLONG - - - - - - - - - - - - - - - - - - - - - - - - - - = -
RAW - - - - - - - - - - - - - - - - - - - - - - - - - - - l, y
  • There are no restrictions for combinations using "x".
  • In combinations with "z", the lengths and decimal places must match in the compared columns or expressions in conditions in an expression.
  • In combinations with "l", the lengths of the compared columns or expressions must match.

The comparability of dictionary types is significant for comparisons with columns or SQL expressions on the right side or for comparisons in SQL expressions. This applies more specifically to literals, host variables, and host expressions when handled as elementary SQL expressions. These elements are mapped to a dictionary type and comparability is identified for the dictionary type in question.

Other versions: 7.31 | 7.40 | 7.54


Notes

  • In the following cases, the syntax check is performed in a strict mode, which handles the statement more strictly than the regular syntax check.

  • SQL expressions of the types DF16_DEC or DF34_DEC are compared with other numeric types except with themselves.

  • SQL expressions of the type SSTRING are compared with types other than themselves in a CASE expression.