ASCII(x) is a string function that converts a character string x (string specification) with the code attribute ASCII, UNICODE (if these are ASCII data) or BYTE into ASCII data. Only expressions that produce an alphanumeric value are permitted as string specifications.
x |
Result of the Function ASCII(x) |
---|---|
x is of data type CHAR or VARCHAR, the code attribute for x is ASCII, UNICODE or BYTE |
ASCII(x) gives a character string in ASCII display |
x is a NULL value |
NULL value |
It can be useful to use ASCII(x) functions if data is to be sorted or compared in ASCII code.
Example
Output of a sorted result table in ASCII order:
SELECT ASCII(name) FROM...WHERE...ORDER BY 1