Consultor Eletrônico



Kbase 17668: The Logical Operator CONTAINS
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/05/1998
The Logical Operator CONTAINS

Often there is a need to determine if a character field or variable
contains a particular string. As documented in the Language reference,
the logical operator CONTAINS may be used only in the context of a
Record Phrase as follows:

WHERE <field> CONTAINS <search-expression>

In this syntax, <field> must be a word-indexed field.
Additionally, CONTAINS cannot be used in a FIND statement.

To get the functionality of '<field> CONTAINS <string>' in all other
cases, use the MATCHES operator with the wildcard character '*' as
follows:

<field> MATCHES "*<string>*"

For example, to find a customer whose name contains the string "Line":

FIND FIRST customer WHERE name MATCHES "*Line*".

This syntax can also be used to find records which do not contain a
given string:

FOR EACH customer WHERE NOT(name MATCHES "*Line*"):

Progress Software Technical Support Note # 17668