WHERE - LIKE

Syntax

... col [NOT] LIKE dobj [ESCAPE esc] ...

Effect

This expression is true if the value of the column col fits (does not fit) the pattern in the data object dobj. It is not possible to specify a column ID for dobj. The data types of the column col and the data object dobj must be character-type.

Wildcard characters can be used to create the pattern in dobj, where "%" represents any character string, even an empty one, and "_" represents any character. Captilatization is taken into account. Blank characters at the end of dobj are ignored. This is also valid in particular for data objects of the type string with closing blank characters that are otherwise taken into account in ABAP.

With the addition ESCAPE, an escape character can be defined. esc must be a flat character-like data object of the length 1, the content of which is used as an escape character. esc is always accessed like a data object of the data type c of the length 1. An escape character may only be placed before a wildcard character or before the escape character itself. In this case, they lose their special meaning. The addition ESCAPE cannot be used when accessing pool (before release 6.10) or cluster tables.

Notes

The semantics of searches of this type are dependent on the database system that is used and in general do not lead to the desired result.

Example

Full-text search in a text table.

PARAMETERS srch_str TYPE c LENGTH 20.

DATA text_tab TYPE TABLE OF doktl.

CONCATENATE '%' srch_str '%' INTO srch_str.

SELECT *
       FROM doktl
       INTO TABLE text_tab
       WHERE doktext LIKE srch_str.