I was able to correctly convert diacritic characters to their lowercase counterparts by creating the following auxiliary table with two columns and inserting pairs of diacritic characters in lower and upper case.
CREATE TABLE Latin1Accents (
UCASE STRING,
LCASE STRING
);
INSERT INTO Latin1Accents (UCASE, LCASE) VALUES
('À', 'à'),
('Á', 'á'),
('Â', 'â'),
('Ã', 'ã'),
('Ä', 'ä'),
('Å', 'å'),
('Ç', 'ç'),
('È', 'è'),
('É', 'é'),
('Ê', 'ê'),
('Ë', 'ë'),
('Ì', 'ì'),
('Í', 'í'),
('Î', 'î'),
('Ï', 'ï'),
('Ñ', 'ñ'),
('Ò', 'ò'),
('Ó', 'ó'),
('Ô', 'ô'),
('Õ', 'õ'),
('Ö', 'ö'),
('Ù', 'ù'),
('Ú', 'ú'),
('Û', 'û'),
('Ü', 'ü'),
('Ý', 'ý');
A CASE is used to verify if the UNICODE representation of the first character in the string is above 127, in order to find out if the character could be a diacritic one. If not, the lower function is used to convert the character. However, if the UNICODE value is above 127, a subquery is used to look for the lowercase representation of that character in the Latin1Accents auxiliary table. If the lowercase character could not be found in that table, the original character is returned.
SELECT Customer_Name,
SUBSTR (Customer_Name,1,1) as "First Letter", UNICODE (SUBSTR (Customer_Name,1,1)) ,
CASE
WHEN UNICODE (SUBSTR (Customer_Name,1,1)) > 127 THEN
(SELECT CASE WHEN LCASE IS NULL THEN SUBSTR (Customer_Name,1,1) ELSE LCASE END
FROM Latin1Accents
WHERE UCASE = SUBSTR (Customer_Name,1,1) )
ELSE
LOWER (SUBSTR (Customer_Name,1,1))
END as "First Letter in Lowercase"
FROM Customer
