SQL/MP Reference Manual

HP NonStop SQL/MP Reference Manual523352-013
C-17
Examples—Character Expressions
Examples—Character Expressions
This example on concatenation results in “Robert Smith”:
"Robert " || "Smith"
Note blanks between names are included in the original string literals.
This example results in “Robert John Smith”:
"Robert " || "John " || "Smith"
This example concatenates “Robert” with a string of length 0, which results in
“Robert”:
"Robert" || ""
This example results in “Robert SMITH”:
"Robert " || UPSHIFT ("Smith")
This example results in “Robert Smith” with the collating sequence FRENCH:
"Robert " COLLATE FRENCH || "Smith"
This SELECT statement returns a null value because one of the two character
string operands has a null value:
>>CREATE TABLE EMPNAME (first_name char(10),
+> last_name char(10));
>>INSERT INTO EMPNAME VALUES ("Robert ", NULL);
>>SELECT ( first_name || last_name ) FROM EMPNAME;
Character Sets
NonStop SQL/MP allows you to associate one of these character sets with a column, a
literal, a host variable, or a parameter:
ISO 8859/1 through ISO 8859/9
Kanji
KSC5601
You can also define a collation that uses any of the nine ISO 8859 character sets and
associate the collation with a column, a literal, an host variable, or a parameter of the
same character set. (You cannot define a collation that uses the Kanji or KSC5601
characters sets. SQL always collates characters from those character sets according
to the binary value of the characters.)
For compatibility with versions of NonStop SQL/MP that do not support multiple
character sets, you can specify UNKNOWN to indicate that the character set is
unknown. SQL considers this equivalent to omitting the character set specification and
handles the data as 8-bit data.