SQL/MX 2.x Reference Manual (G06.24+, H06.03+)

SQL/MX Language Elements
HP NonStop SQL/MX Reference Manual523725-004
6-23
Character String Data Types
NCHAR Columns in SQL/MP Tables
In NonStop SQL/MX and NonStop SQL/MP, the NCHAR type specification is
equivalent to:
NATIONAL CHARACTER
NATIONAL CHAR
CHAR ... CHARACTER SET ..., where the character set is the default character
set for NCHAR
Similarly, you can use NATIONAL CHARACTER VARYING, NATIONAL CHAR
VARYING, and VARCHAR ... CHARACTER SET ... .
SQL/MP Considerations for Character String Data Types
Selecting NCHAR Columns
NonStop SQL/MX supports accessing KANJI- or KSC5601-aliased NCHAR columns in
an SQL/MP table. For example, suppose that an SQL/MP table has an NCHAR column
defined as:
MPNcharCol NCHAR(10)
You can select from this column as shown:
SELECT MPNcharCol FROM MPTable;
This query returns ten characters for each row.
Using the CHAR Keyword in the CAST Operation
You can also use the CAST operation to ensure a certain number of characters are
returned from a query. For example:
SELECT CAST(MPNcharCol AS CHAR(5) character set KANJI) FROM
MPTable;
This query returns five characters for each row.
You can also insert into or update NCHAR columns in SQL/MP tables. See Inserting
Into or Updating SQL/MP NCHAR Columns on page 6-64.