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 Expressions
Other versions: 
 7.31 | 7.40 | 7.54
Syntax
 ... { {operand1 {=|EQ|<>|NE|>|GT|<|LT|>=|GE|<=|LE} operand2 } 
    | {operand  [NOT] BETWEEN operand1 AND operand2} 
    | {operand1 [NOT] LIKE operand2 [ESCAPE esc]} 
    | {operand  IS [NOT] NULL} 
    | {operand  IS [NOT] INITIAL} } ...
Effect
Relational expression in a condition of an expression in an ABAP SQL statement. Logical expressions
sql_cond can be formed from the relational expressions shown here for the following conditions:
- ONcondition in the definition of a CTE association.
- WHENcondition of a complex case distinction
- Start condition of the table function HIERARCHY.
- WHERE,- ON, and- START WHEREcondition in a hierarchy aggregate navigator.
The relational expressions that can be used in expressions are a subset of the relational expressions for statements, but also allow SQL expressions as operands on the right side.
- operand1 =|<>|>|<|>=|<= operand2
operand1 on the left side with the operand operand2 on the right side.  The same applies to relational operators as in a
condition for statements. The operands of size comparisons can have the following data types here:
- Numeric data types: All except the replacement types for decimal floating point numbers
- Character-like data types: CHAR, CLNT, LANG, CUKY, UNIT, and NUMC
- Date types, time types, and time stamp types: DATN, DATS, TIMN, TIMS, and UTCLONG
operand2 on the right-hand side can be any
SQL expression except
aggregate expressions and
window expressions. If an operand of the comparison has the
null value, the result of this comparison is unknown.
- operand [NOT] BETWEEN operand1 AND operand2
operand1 and operand2, any
SQL expressions except
aggregate expressions and
window expressions can be specified. If one of the operands has the
null value, the result of the check is unknown.
- operand1 [NOT] LIKE operand2 [ESCAPE esc]
NOT is not possible. The same applies to the operands as in the
condition for statements. The operands must be character-like and only
literals and host variables can be specified on the right-hand side.
- operand IS [NOT] NULL
- operand IS [NOT] INITIAL
The operands on the left-hand side can be any SQL expressions except
aggregate expressions and
window expressions. Any occurring columns and expressions
(with the exception of LIKE) can have any dictionary type except ACCP, DF16_SCL
(obsolete), DF34_SCL (obsolete), LCHR, LRAW, PREC, RAWSTRING, STRING, and GEOM_EWKB. Individually specified literals, host variables, and host expressions are handled as
elementary SQL expressions and can be of any ABAP type, except string and xstring.
It must be possible to compare the data
types of the operands of a relational expression. If this is not the case, a statically specified type raises a syntax error and a dynamically specified type raises an exception of the class CX_SY_DYNAMIC_OSQL_SEMANTICS. Unlike in
conditions for statements, operands of the types DATS and TIMS are handled like regular flat character-like operands.
If an expression is used for a selection, the client column of a client-specific data source of a query or the target of a write statement in an SQL condition of this expression cannot be used as an operand. This is due to implicit client handling.
Notes
- Because an expression is passed to the database essentially unchanged, the possible relational expressions and their operands represent only a subset of the
relational expressions for statements. In some constructs,
however, a WHERE,HAVING, orONcondition of a statement is processed by the ABAP runtime environment before the pass, to ensure platform-independent behavior.
- When specifying literals, host variables, and host expressions, note that these are used as elementary SQL expressions in expressions and that their ABAP type is mapped to a dictionary type according to the corresponding tables. This type must fulfill the comparability rules. This differs from relational expressions for statements, for which the ABAP type is generally converted to the appropriate dictionary type.
- The addition NOTcannot currently be specified in front ofBETWEENandLIKE. Instead, the operatorNOTcan be used in front of the full expression.
- A client column can be used as an operand only if
implicit client handling is disabled using the addition CLIENT SPECIFIEDfor the query or the write. This is not possible for filter conditions. s