Gregor Kova wrote:

Hmm, so if the field FIELD1 is VARCHAR(10000) (for example) then the

value for ? should be 'EXAMPLE(and 9993 spaces)'?

What if the ? is an empty string? Should I provide 10000 spaces?

String comparisons

Character strings are compared according to the collating sequence

specified when the database was created, except those with a FOR BIT

DATA attribute, which are always compared according to their bit values.

When comparing character strings of unequal lengths, the comparison is

made using a logical copy of the shorter string, which is padded on the

right with blanks sufficient to extend its length to that of the longer

string. This logical extension is done for all character strings,

including those tagged as FOR BIT DATA.

Description of LIKE predicate apttern:

Let m denote the value of match-expression and let p denote the value of

pattern-expression. The string p is interpreted as a sequence of the

minimum number of substring specifiers so each character of p is part of

exactly one substring specifier. A substring specifier is an underscore,

a percent sign, or any non-empty sequence of characters other than an

underscore or a percent sign.

The result of the predicate is unknown if m or p is the null value.

Otherwise, the result is either true or false. The result is true if m

and p are both empty strings or there exists a partitioning of m into

substrings such that:

* A substring of m is a sequence of zero or more contiguous

characters and each character of m is part of exactly one substring.

* If the nth substring specifier is an underscore, the nth

substring of m is any single character.

* If the nth substring specifier is a percent sign, the nth

substring of m is any sequence of zero or more characters.

* If the nth substring specifier is neither an underscore nor a

percent sign, the nth substring of m is equal to that substring

specifier and has the same length as that substring specifier.

* The number of substrings of m is the same as the number of

substring specifiers.

Thus, if p is an empty string and m is not an empty string, the result

is false. Similarly, it follows that if m is an empty string and p is

not an empty string (except for a string containing only percent signs),

the result is false.

The predicate m NOT LIKE p is equivalent to the search condition NOT (m

LIKE p).

You may also consider using '_' instead of or in addition to '%' in LIKE

predicate pattern.

Jan M. Nelken