nchar_mapping - National character mapping configuration parameter

This parameter determines the data type mapping for national character string data types in MBCS databases.

Configuration type
Database
Parameter type
Configurable online
Default [range]
CHAR_CU32 [CHAR_CU32, GRAPHIC_CU32, GRAPHIC_CU16, NOT APPLICABLE]

If you are using an SBCS database, the value of nchar_mapping is NOT APPLICABLE because there is no support for specifying national character string data types in SBCS databases. In a non-Unicode, DBCS database, the only valid option is CHAR_CU32.

The national character string data type mapping is as follows:

Table 1. Mapping between national character strings and data types
Parameter Value NCHAR NVARCHAR NCLOB
CHAR_CU32 CHAR in string units CODEUNITS32 VARCHAR in string units CODEUNITS32 CLOB in string units CODEUNITS32
GRAPHIC_CU32 GRAPHIC in string units CODEUNITS32 VARGRAPHIC in string units CODEUNITS32 DBCLOB in string units CODEUNITS32
GRAPHIC_CU16 GRAPHIC in string units CODEUNITS16 VARGRAPHIC in string units CODEUNITS16 DBCLOB in string units CODEUNITS16

Effects of changing the value of nchar_mapping

  • Materialized query tables (MQTs) might contain different results after altering the nchar_mapping value. To ensure that previously created MQTs contain only data that adheres to the new format, refresh these MQTs by using the REFRESH TABLE statement.
  • The results of a trigger might be affected by the changed format. Altering the nchar_mapping value has no effect on data that has already been written.
  • Constraints that allowed data to be inserted into a table might, if reevaluated, reject that same data. Similarly, constraints that did not allow data to be inserted into a table might, if reevaluated, accept that same data. Use the SET INTEGRITY statement to check for and correct data in a table that might no longer satisfy a constraint.
  • After changing the value of nchar_mapping, recompile all static SQL packages that depend on the value of a generated column whose results are effected by the change in the nchar_mapping value. To find out which static SQL packages are effected, you must compile, rebind all the packages using the db2rbind command.
  • The value of an index with expression-based keys whose calculation is dependent on nchar_mapping will be different after changing the value of nchar_mapping. Drop and recreate all potentially impacted expression-based indexes after changing the value of nchar_mapping. If you are not sure that a particular expression-based index is impacted, it is best to drop and recreate the index to avoid incorrect values in the index.