ASCII

Converts the first character of a VARCHAR datatype to an INTEGER.

Behavior Type

Immutable

Syntax

ASCII ( expression ) 

Parameters

expression

(VARCHAR) is the string to convert.

Notes

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)