NPRao
30th January 2006, 23:09
New feature in LN -

SSA ERP LN 6.1 Programmers Guide

Like predicate
--------------------------------------------------------------------------------
SSA ERP LN SQL has two like keywords: LIKE and ALIKE.
The handling of the LIKE keywords depends on the optional mode argument of the sql.parse() function. With the PARSE.ANSI flag set, the LIKE keyword is a synonym of the ALIKE keyword.
If this flag is not set, the LIKE predicate evaluates to True if the value expression matches the string pattern. The matching is based on Regular Expressions.

The ALIKE predicate evaluates to True if the value expression matches the string pattern. Within this string, the character % matches any string of zero or more characters except NULL. The character _ matches any single character. A wildcard character will be treated as literal if preceded by the escape character as defined by the optional ESCAPE keyword.

Syntax
<like predicate>
::= <ansi-like predicate> | <regexp-like predicate>

<ansi-like predicate>
::= <value expression> [NOT] ALIKE <string constant>
[ESCAPE <string constant>]

<regexp-like predicate>
::= <value expression> [NOT] LIKE <string constant>

Syntactical restrictions
The ALIKE keyword generates a syntax error when the PARSE.ANSI flag is set in the optional mode argument of the sql.parse() function.
Examples
The following predicate evaluates to True if firstname is 'CHRISTINE'. Note: no blank padding is applied! So, if firstname is 'CHRISTINE ' it evaluates to False.
firstname LIKE 'CHRISTINE'
The following predicate evaluates to True if firstname starts with an 'A'.
firstname LIKE 'A.*'
firstname ALIKE 'A%'
The following predicate evaluates to True if firstname start with a 'C' or an 'H'.
firstname LIKE '[CH].*'
The following predicate evaluates to True if firstname does not start with an 'I'.
firstname LIKE '[^I].*'
Semantics
If the value expression is NULL, then the result of the LIKE predicate is Unknown.

The result of the LIKE predicate (non ansi mode) is equivalent with the following expression using expr.compile() and using the value of the value expression for the optional argument to l.expr().
$$ IN "<string constant>"