MAPCHAR(x,n,i) is a string function that converts country-specific letters (string specification x) to a different format (e.g. German umlauts, French letters with a grave accent).
MAPCHAR(x,n,i) uses the MapChar set with the name i (mapchar set name) to convert the character string x (string specification). Only expressions that produce an alphanumeric value are permitted as string specifications.
The code on which the character string x is based and the code on which the implemented MapChar set is based must match.
If you do not specify a MapChar set name, the MapChar set with the name DEFAULTMAP (defined for the ASCII code) is used. In Unicode-based database systems string specifications are Unicode. So if necessary convert the string specification to an ASCII expression (using for example the function ASCII(x)).
The n parameter (unsigned integer) is optional; n specifies the maximum length of the result.
x, n, i |
Result of the MAPCHAR(x,n,i) function |
---|---|
MAPCHAR(x,i) |
MAPCHAR(x,n,i), whereby n is the length of the character string x |
MAPCHAR(x,i) x is a CHAR or VARCHAR column |
MAPCHAR(x,n,i), whereby n is the length of the column x |
MAPCHAR(x) |
MAPCHAR(x,DEFAULTMAP) |
x is a NULL value |
NULL value |
Example
The MAPCHAR function enables data to be sorted correctly, for example, if "ü" is to be treated as "ue" for sorting purposes. The MapChar set with the name DEFAULTMAP is used.
SELECT ...,MAPCHAR(<column_name>) sort,... FROM ... ORDER BY sort