See: fooobar.com/questions/1324964 / ...
Database setup
There is a database configuration setting that you can set in creating the database . However, it is based on unicode.
CREATE DATABASE yourDB USING COLLATE UCA500R1_S1
The default Unicode sorting algorithm is implemented by the keyword UCA500R1 without any attributes. Because the UCA by default cannot simultaneously include a sort sequence in each Unicode-supported language, additional attributes can be specified to configure the UCA order. Attributes are separated by an underscore (_). The UCA500R1 keyword and any attributes form the UCA sort name.
The Strength attribute determines whether accent or occasion is considered when matching or comparing text strings. When writing systems without incident or emphasis, the Strength attribute controls similarly important functions. Possible values: primary (1), secondary (2), tertiary (3), quaternary (4) and identical (I). To ignore:
- emphasis and occasion, use the level of primary strength.
- use secondary strength level
- neither accent nor case, use tertiary strength level
Almost all symbols can be selected using the first three levels of strength, so in most locations the Strength attribute is set to the tertiary level by default. However, if the Alternate attribute (described below) is set to a shift, then the Quaternary Strength level can be used to break the links between space characters, punctuation marks, and characters that would otherwise be ignored. A strong identity level is used to distinguish among similar characters, such as MATHEMATICAL BOLD SMALL A (U + 1D41A) and MATHEMATICAL ITALIC SMALL A (U + 1D44E).
Setting the Strength attribute to a higher level slows down the comparison of lines of text and increases the length of the sort keys. Examples:
- UCA500R1_S1 will match "role" = "Role" = "rΓ΄le"
- UCA500R1_S2 will map "role" = "Role" <"ROLE"
- UCA500R1_S3 will map the "role" <"Role" <"ROLE"
It worked for me. As you can see ... S2 also ignores case.
Using the newer standard version , it should look like this:
CREATE DATABASE yourDB USING COLLATE CLDR181_S1
Sort keywords :
UCA400R1 = Unicode Standard 4.0 = CLDR version 1.2
UCA500R1 = Unicode Standard 5.0 = CLDR version 1.5.1
CLDR181 = Unicode Standard 5.2 = CLDR version 1.8.1
If your database is already created, it is assumed that it will change the setting .
CALL SYSPROC.ADMIN_CMD( 'UPDATE DB CFG USING DB_COLLNAME UCA500R1_S1 ' );
I am having problems with this, but I know that it should work.
Table row generated
Other options include, for example, generating an uppercase string :
CREATE TABLE t ( id INTEGER NOT NULL PRIMARY KEY, str VARCHAR(500), ucase_str VARCHAR(500) GENERATED ALWAYS AS ( UPPER(str) ) )@ INSERT INTO t(id, str) VALUES ( 1, 'Some String' )@ SELECT * FROM t@ ID STR UCASE_STR