Generating reports : Specifying job parameters : Supplying a parameter value : Using a special character to match one or more characters in a QBE string

Using a special character to match one or more characters in a QBE string

Table 3-5 lists characters that have special meanings in a string in a QBE expression.

Table 3-6 provides examples of QBE expressions that use the preceding special and literal characters.

Using the percent character to match any set of characters or blank characters

The percent sign (%) matches any set of characters or blank characters. The application adds a percent sign to a string supplied as a QBE expression when all of the following conditions are true:

n  
n  
n  

The application adds a percent sign to ensure blank characters at the end of strings in the database do not interfere with the matching process. If you do not want the application to add the percent sign (%) to the end of a string, enclose the string in single quotation marks in the QBE expression.

Table 3-7 illustrates the results of the application adding a percent sign to QBE expressions.

To match values ending in a space character when the QBE expression contains a percent character, append a percent character to the QBE expression. For example:

Sm%th%

This syntax is valid only for LIKE. The application does not add a percent character to a BETWEEN clause. For example, if the database column custName is of type string, and the report user types D as the value of the ad hoc parameter, the query retrieves the data row that contains Design Boards, however, if the report user types A-D as the ad hoc parameter value, Deployment Kit does not match customer records where custName is Design Boards. QBE expression values that retrieve values starting with A through D appear in Table 3-8, including one to which the application adds a percent sign.

custName LIKE 'A%' OR
custName LIKE 'B%' OR
custName LIKE 'C%' OR
custName LIKE 'D%'

Using the bracket characters to specify a set of matching characters

With many data sources, you can use brackets ([ and ]) to specify a set of matching characters. Data sources that support using brackets in this manner handle any special characters enclosed by brackets as literal characters. For example, the following QBE expression encloses the percent sign (%) and uses it literally:

ab[%]c