ASCII
Converts the first character of a VARCHAR datatype to an INTEGER.
Behavior Type
Syntax
ASCII ( expression )
Parameters
expression |
(VARCHAR) is the string to convert. |
Notes
- ASCII is the opposite of the CHR function.
- ASCII operates on UTF-8 characters, not only on single-byte ASCII characters. It continues to get the same results for the ASCII subset of UTF-8.
Examples
This example returns employees whose last name begins with M. The ASCII equivalent of M is 77:
=> SELECT employee_last_name FROM employee_dimension WHERE ASCII(SUBSTR(employee_last_name, 1, 1)) = 76 LIMIT 5; employee_last_name -------------------- Lewis Lewis Lampert Lampert Li (5 rows)