ALPHA(x,n) is a string function that enables a character x (string specification) in ASCII to be converted to a different one or two-character representation defined in the DEFAULTMAP (mapchar_set_name). Only expressions that produce an alphanumeric value are permitted as string specifications.
ALPHA(x,n) is used to define the sort sequence.
The function ALPHA(x,n) uses the MAPCHAR(x,n,i) function internally (where i is the DEFAULTMAP) and also performs a conversion to uppercase letters (UPPER(x)).
x, n |
Result of the ALPHA(x,n) Function |
---|---|
x is a character n is an unsigned integer |
UPPER(MAPCHAR(x,n,DEFAULTMAP)) |
Specifying n (an entire number without a sign) is optional. n specifies the maximum length of the result.
Example
The ALPHA function allows a useful sorting process, for example, when "ü" should be sorted as "UE". The mapchar set with the name DEFAULTMAP is used.
SELECT...,ALPHA(<column_name>) sort,...FROM...ORDER BY sort