I'm struggling with DB2 – sorting by Polish letters with diacritics and uppercase/lowercase. When I created a database using:
CREATE DATABASE P1DS8 AUTOMATIC STORAGE YES ON '/home/db2inst1' DBPATH ON '/home/db2inst1' USING CODESET UTF-8 TERRITORY PL COLLATE USING SYSTEM_912_PL PAGESIZE 32 K
Sorting by Polish letters works properly, however ascending sorting returns results ordered by lowercase as first aAbB… How I can change this setting to revert results to AaBb..?
Is the 'COLLATE' section is responsible for all aspects of sorting? (Specific language letters, lowercase, uppercase etc. )
Best Answer
You'd need to use the UCA (Unicode Collating Algorithm): the
COLLATE
value would be something likeUCA500R1_LPO_CU
for Polish and uppercase first. More info here.Note that you cannot change the collating setting of an existing database; you would have to create a new one with the required collation and move your data.