SQL/MP Report Writer Guide

Selecting Data for a Report
HP NonStop SQL/MP Report Writer Guide527213-001
3-11
Developing a Query
+> WHERE STREET, CITY, STATE =
+> "2300 BROWN BLVD", "FRESNO", "CALIFORNIA";
Comparing Character Values
If a column contains text (character data), you must enclose the comparison value in
single or double quotation marks. You must enter the characters you want to match
exactly as the characters are stored in the column. For example, to find a value that
consists of uppercase letters, enter uppercase letters. You must also include the same
number of spaces within the comparison string as there are spaces stored within the
column value.
The following predicate will not select "PC Diamond, 60 MB" or "PC DIAMOND,
60MB".
+> AND PARTDESC = "PC DIAMOND, 60 MB";
You can use the UPSHIFT function to select without regard to whether a character
value is in lowercase or uppercase. For example, the following predicate selects "PC
Diamond, 60 MB" and "PC DIAMOND, 60 MB" but not "PC DIAMOND, 60MB"
(because of the missing space):
+> AND UPSHIFT (PARTDESC) = "PC DIAMOND, 60 MB";
The LIKE predicate lets you look for similar values by specifying only a few characters
and using the following wild-card characters:
% Percent sign indicates zero or more characters of any type are acceptable.
_ Underscore indicates any single character is acceptable.
Character data can be stored in columns of data type CHAR, PIC X, VARCHAR,
NATIONAL CHAR, and NCHAR.
PIC X columns, and CHAR, NATIONAL CHAR, and NCHAR columns defined without
the VARYING clause, contain fixed-length values; every row of the table contains a
value of the same length in the column. When you insert a value, the system fills the
value with blanks if necessary.
VARCHAR columns and CHAR, NATIONAL CHAR, AND NCHAR columns defined
with the VARYING clause contain variable-length values; values vary in length from
row to row. When you insert a value, only the characters you enter are stored.
Note. To compare character data that uses collations, see “COMPARISON” in the SQL/MP
Reference Manual
Note. TUPSHIFT is a function that upshifts single-byte characters. You cannot use the
UPSHIFT function if the column contains a double-byte character set, such as Tandem Kanji or
Tandem KSC5601.