Ansicht
Dokumentation
ABENCDS_COND_EXPR_LIKE_V1 - CDS COND EXPR LIKE V1
BAL_S_LOG - Application Log: Log header data SUBST_MERGE_LIST - merge external lists to one complete list with #if... logic for R3upThis documentation is copyright by SAP AG.
- DDIC-Based View, cds_cond, LIKE
... lhs $[NOT$] LIKE rhs $[ESCAPE esc$]...
Addition:
... ESCAPE esc
Effect
Pattern comparison in a condition in a . The relational expression is true if the string in lhs matches (does not match) the pattern in rhs.
Rules for the operands lhs and rhs:
- The operand lhs must stick to the context-dependent rules listed in topic CDS DDL - DDIC-based View, cds_cond, Operands.
- The data types of the operands must be comparable as described in topic CDS DDL - DDIC-based View, cds_cond, Comparable Types. Only character-like data types can be used.
- For rhs, only character-like literals without domain prefix are allowed.
Rules for the pattern in rhs:
- '%' is a wildcard character that represents any character string (including an empty string)
- '_' stands for any character
Notes
- Do not use patterns in rhs that are closed by wildcard characters to search for trailing blanks. The semantics of searches of this type are dependent on the database system that is used and in general do not produce the required result.
- If lhs contains the null value, then the comparison lhs LIKE '%' is not true. In , this comparison is true (as described in topic sql_cond, LIKE).
Addition
... ESCAPE esc.
Effect
The addition ESCAPE can be used to define a single-character escape character. esc expects a character-like literal with the length 1 containing the escape character. In the pattern in rhs, the escape character in esc can be placed before a wildcard character or before the escape character itself. Then, the character directly following the escape character loses its special meaning.
If an escape character in rhs is not placed in front of one of the valid characters, a syntax error occurs.
The character # is recommended for the escape character esc.
Example
To search for the pattern '100%', the following expression can be used with # as the escape character.
... LIKE '100#%' ESCAPE '#' ...
BAL Application Log Documentation Vendor Master (General Section)
This documentation is copyright by SAP AG.
Length: 4992 Date: 20240420 Time: 080229 sap01-206 ( 48 ms )