Db2 – Character Strings related : string_units db cfg changed from SYSTEM to CODEUNITS32

db2db2-10.5db2-luwunicode

To handle few special characters, we changed string_units database configuration parameter from default SYSTEM to CODEUNITS32.

Based on IBM DB2 Knowledge Center, there are three methods to achieve this.

1.Set the NLS_STRING_UNITS global variable

2.Update the string_units database configuration parameter

  1. Alter the column by defining new character set ( CODEUNITS16 or CODEUNITS32)

We have used the second option and restarted the instance. Still it's not working as expected. Have we missed any steps?

Is the reorg required on the table? What happens to the already existing data ?

db2level – 10.5 fp5
OS : Windows

Best Answer

ALTER TABLE <schema>.<tabname> ALTER COLUMN <colname> SET DATA TYPE VARCHAR(20 CODEUNITS32);

The alter column set data type with CODEUNITS32 clause did the job. If the string_units database configuration parameter is set to CODEUNITS32, any new table without specifying this clause in column definition still works.

We have to perform the above alter only to the columns of existing table which was defined when string_units was set to default SYSTEM.

Hope it helps to other users.