SQL/MP Reference Manual
HP NonStop SQL/MP Reference Manual—523352-013
C-64
Considerations—CONCAT
For more information about these descriptors, see Display Descriptors for
Character Items on page A-61. Note that the Cn.[w] format described under AS is
not allowed in the CONCAT clause.
STRIP
directs the report writer to strip trailing blanks from the values in the list before
concatenating them.
SPACE number
specifies the number of spaces between the items in the list. Each space occupies
one single-byte print position, regardless of the character set used.
If you omit this clause, the default is 0. (Note that this default is different from the
default for the SPACE clause on other statements.) If you specify SPACE but omit
number, the default is 1.
Considerations—CONCAT
Items specified in a CONCAT clause have no default heading. You must specify a
heading if you want one.
The default format for a item built from concatenated items is An, in which n is the
sum of the widths of the concatenated items.
The width of an item from a table is the width specified in the catalog definition for
the column that contains the item. The width of a string literal is the number of
characters in the string. The report writer estimates and sets a maximum width for
the result of an expression.
You can concatenate single and double-byte characters, but you should avoid
concatentations that cause double-byte characters to begin or end in the middle of
a word. SQL does not prevent this, but the characters in such strings will be
scrambled if you attempt to print them using SQLCI.
Example—CONCAT
This clause concatenates the CITY and STATE values and restricts the formatted
result to 25 single-byte characters:
CONCAT ( CITY STRIP, ", ", STATE) AS A25
Suppose that a column of the report contains these. Note that the entry for North
Carolina is truncated to 25 single-byte characters.
AJO, ARIZONA
NEEDLES, CALIFORNIA
WHEAT RIDGE, COLORADO
SECAUCUS, NEW JERSEY
SWEET HOME, OREGON
WINSTON-SALEM, NORTH CARO